GetDunne Wiki

Notes from the desk of Shane Dunne, software development consultant

User Tools

Site Tools


api_guessing_game

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
api_guessing_game [2017/09/30 19:23]
shane [Documentation hints for library developers/vendors]
api_guessing_game [2017/10/01 14:44] (current)
shane [Read this even if you skipped to the bottom]
Line 2: Line 2:
 Some day I intend to write an eloquent essay on the virtues of good software documentation, particularly as it applies to software libraries for use by other programmers. For the moment, I will say only this: Some day I intend to write an eloquent essay on the virtues of good software documentation, particularly as it applies to software libraries for use by other programmers. For the moment, I will say only this:
   * Once one achieves a basic level of coding competence, programming mainly involves //choosing appropriate libraries//, //understanding their APIs//, and debugging.   * Once one achieves a basic level of coding competence, programming mainly involves //choosing appropriate libraries//, //understanding their APIs//, and debugging.
-  * All three aspects require good documentation above all.+  * All three aspects require //good documentation// above all else.
   * Good API documentation requires exactly two things:   * Good API documentation requires exactly two things:
     - //Working client code//     - //Working client code//
-    - //Explanation of how the API is supposed to be used// +    - //Explanation of how the you **intend** your API to be used// 
-  * Most API documentation has neither, and as a result, programming becomes an exercise in //guessing the intent// of the library/API authors. I call this the **API Guessing Game**.+  * Most API documentation has neither, and as a result, programming becomes an exercise in //guessing the intent// of the library authors. I call this the **API Guessing Game**.
  
-===== Elements of the API Guessing Game ===== +===== Signs that one is stuck in the API Guessing Game ===== 
-  * Having to write code "experimentally" for one specific function call, and run it repeatedly to observe whether or not it works, what the return values are, etc., because the authors didn't bother to write it down+  * Writing "experimentalcode for one specific function call, and running it repeatedly after little changes, to observe whether or not it succeeeds, what the return values are, etc..
-  * Having no idea how to start implementing an operation using the library. +  * Having no idea how to start implementing an operation (even a common one) using the library..
-  * Having no which parts of the library are fundamental and unlikely to change, as opposed to those which are still under development. +  * Having no which parts of the library are fundamental and unlikely to change, as opposed to those which are still under development..
-  * Having high confidence that a specific class (or group of functions and data structures) is the right one for a specific purpose, but having no idea of the order in which the various functions are supposed to be called.+  * Being fairly sure that a specific class (or group of functions and data structures) is the right one for a specific purpose, but having no idea of the order in which the various functions are supposed to be called... 
 + 
 +//...because the authors didn't bother to write it down.//
  
 ===== Documentation hints for library developers/vendors ===== ===== Documentation hints for library developers/vendors =====
Line 22: Line 24:
   * If I have to search FAQs and Forums to figure out how to do something basic, //which I know every other user will need to do//, you're doing it wrong.   * If I have to search FAQs and Forums to figure out how to do something basic, //which I know every other user will need to do//, you're doing it wrong.
   * Code examples (including code which is //generated// by any code-generation tools you provide) //must// represent your //recommended coding style and order of operations//.   * Code examples (including code which is //generated// by any code-generation tools you provide) //must// represent your //recommended coding style and order of operations//.
 +  * Always remember that, if I choose your library, //I expect to continue to use it through multiple versions.// You have to give me some clues about how to write client code which won't break too easily.
  
 +===== Read this even if you skipped to the bottom =====
 +Choosing to use someone else's code library and API is (or //should be//) a //buy-or-build// decision---I choose to use your code because it's more cost-effective than writing my own. So,
 +  * If I'm stuck using your code because there's no alternative (I'm looking at you, Microsoft and Apple), then your failure to provide and maintain adequate documentation is //abuse of privilege// and I will hate you for it.
 +  * If your library is the best thing around, but your commercial license fees are exorbitant (I'm looking at you, Intel, and pretty much every DSP library vendor on the planet), your documentation had better be first-class or I will look elsewhere.
 +  * If your library is free and/or open-source, I thank you from the bottom of my heart, and I realize your resources are limited, but consider your legacy. Either make an effort to provide documentation, or find a collaborator who can.
 +  * Whoever you are, don't give me attitude. You may be very clever, but you're not //that// clever.
  
api_guessing_game.1506799413.txt.gz · Last modified: 2017/09/30 19:23 by shane