Slashdot Mirror


HOWTO Document and Write an SDK?

jmwmit asks: "A startup that I am working with is looking to write its first SDKs - one public for community developers and one for 3rd party commercial developers. What is the Slashdot recommended or preferred format for SDK documentation, both the code APIs and the general docs? What great SDK examples have people used in the past and would recommend as good models? What do Slashdot developers consider absolutely necessary features in an SDK, regardless of the application?"

78 comments

  1. Think about it by l0rd · · Score: 4, Insightful

    Just think long and hard when you design it. There's nothing annoying than having to overhaul your code becuase a function/class syntax has been changed.

    1. Re:Think about it by jgrahn · · Score: 2, Insightful
      Just think long and hard when you design it. There's nothing annoying than having to overhaul your code becuase a function/class syntax has been changed.

      And don't just think -- use the thing for real-life work yourselves. I cannot see how one can come up with a good interface without that feedback.

  2. What helps me by secondsun · · Score: 4, Interesting

    What makes a good SDK is decent documentation and design. What makes an excellent SDK is well though out designs and very detailed documentation. Code examples, comments, descriptions of functions functions, parameters, and return values.

    Sun has done a wonderful job with java and documentation. The only thing that I would like to see added to it would be links to items that reference each function/object.

    A project that has done an awful job at documentation and design is Squeak. There is little documentation and almost every function imaginable is in the Object superclass.

    --
    There is nothing wrong with being gay. It's getting caught where the trouble lies.
    1. Re:What helps me by yasth · · Score: 2, Insightful

      Not just code examples but both non trivial examples and trivial examples. A reference application allows the developer to see how the design fits together (and can be used to test the viability of the design), while trivial examples allow copy and paste programming which on some projects is deadline dictated.

      Sun's documentation is very well done. What is more is most of the various add ons are well documented, Javadoc really works well.

      Also it helps a lot to have a nice quick start. Really look at what a lot of embeded systems companies have done lately, there is a serious push to do everything possible to just let the develepor to get on with life. Mostly it is just detailed documentation, just add water examples, and lots of communication (i.e. if you are having trouble with something you will end up speaking to the engineer who did that section.).

      --
      I'd do something interesting, but my server can't handle a slashdotting.
    2. Re:What helps me by Software · · Score: 2, Informative
      JavaDoc is nice, but Sun discourages the use of sample code in JavaDoc. For this reason, I find JavaDoc less useful than Microsoft's MSDN documentation or the documentation typical of a Perl module. JavaDoc is good when you can't remember some detail about the object or method you're using, but it's not good when you're just starting out. Sun would say, "That's what a tutorial is for! JavaDoc is an API reference, not a tutorial.", but why not have both?

      Sun's guide to writing JavaDoc has lots of good ideas, regardless. As does Sun's guide to API specs.

    3. Re:What helps me by webhat · · Score: 1

      That's true, when I started using the pike scripting language, an OO language based on lpc. Each chapter on a subject was a reference with an example being expanded on with each of the referenced functions used. At the end of a chapter on say Stdio.FILE you would have a little network daemon.
      I readlly liked the way the graphics chapter was set up too, each function started with a base graphic and showed what would happen if this function, with arguments, was applied to the graphic in question.

      Sadly I don't use the language anymore. I quit around version 7 as it was getting overly complex to program with, and the documentation was no longer up to par with the language. And not to forget the menory leaks...

      --
      'I am become Shiva, destroyer of worlds'
    4. Re:What helps me by pavon · · Score: 2, Informative

      There are two things needed to learn a new system quickly - a good reference giving the details of every function in the SDK, and documents giving the big picture. The former is pretty easy to understand how to do well and there are good tools like javadoc or Doxygen that help with this task.

      The latter is the one that is lacking most often. You can see very quickly whether a geek or technical writer was in charge of the documentation. If it was a geek this document is non-existent, and at best you have few code examples to help you get the big picture.

      If it was done by technical writers it is extremely verbose, baby-stepping you through everything. This is something that mangers have a hard time understanding - if documentation is so overwhelming that it is faster and easer to learn by jumping into the code, then you are not much better off than when you had no documentation at all.

      My suggestion would be to write a document that you would like to read. Give a quick overview of the organization / concepts of your libraries, and then quick code examples demonstrating how they fit together. If there is something that seems to verbose, or explains things that every computer programmer should know, either take it out or maintain two documents - the "expert" overview and the tutorial.

      If there are any common pitfalls/misconceptions with your SDK (and you can't change the SDK to improve the situation) make sure they are in there. It is sometimes hard to write this yourself as you are already familiar with the SDK, and so you may not think to put down some things. For this reason, you should get help from people who are programmers but are not familiar with the SDK yet and/or are in the process of learning it. If there are any common questions, that means the documentation is lacking in that area. And of course this does not supersede the need for more in-depth (and well commented) code examples.

    5. Re:What helps me by Jjeff1 · · Score: 1

      Personally, I like nothing better than code examples, and lots of them. I've never really used a SDK, but I have done enough programming in different languages to know what helps me turn out productive code quickly.

      While not a SDK, take a look at the book On To C. This is the best programming book I've ever read. It is example heavy and assumes the reader already is familiar with programming. For example, it doesn't attempt to explain what a variable is or why you'd want to declare one, just how to do so, then provdes examples.

    6. Re:What helps me by Anonymous Coward · · Score: 0

      Sun has done a wonderful job with java and documentation.
      I am sure many will disagree - I *hate* javadoc and don't recall seeing an appealing piece of documentation and example in there anytime. It sounds like some one was forced to death in order to write those javadocs - no creativity no cheer, no urge that reader should understand it well and easy..

    7. Re:What helps me by rabbit78 · · Score: 1

      Sun has done a wonderful job with java and documentation. The only thing that I would like to see added to it would be links to items that reference each function/object.

      Uhh, this may be true for some parts, but lots of the documentation is crap. Look for example at javax.swing.text.rtf.RTFEditorKit: "We didn't wrote this but hope to improve it later" or even better javax.swing.JViewport: "Hey we have a cool and fast implementation but won't tell you what a JViewport is". The API docs are full of this, and if you are trying to implement the API like the folks at GNU Classpath (including me) then you will see that Sun's JDK isn't really good. Besides this funny things in the documentation there are lots of redundant methods (some of them deprecated), stuff that behaves different than documented (again look closely at RTFEditorKit!) etc etc

    8. Re:What helps me by ievans · · Score: 2, Informative

      They usually do provide both. I work on the J2EE Tutorial, which documents the APIs included in the J2EE platform. There's also the Java Tutorial, which documents the standard JDK/JRE platform APIs. For other APIs, check the BluePrints or other tutorials & code camps. Not to mention the case studies and the code samples bundled with other distributions.

      The problem with including tutorial or extensive sample material in API documentation is it's too disparate, and not useful when dealing with more complex applications that use a number of APIs. If you're writing a servlet that uses JDBC to pull data from a database, where does the sample code go?

      -ian

    9. Re:What helps me by Anonymous Coward · · Score: 0
      Okay, you have a point. However, I've been programming in Java for years and still do so daily for about 80% of my time, and I have never used, seen, or even heard of either of the classes you mentioned.

      Java's not my favorite language, but their documentation is amazing on average. That doesn't mean it's uniformly perfect, but pulling out two obscure classes that 1% of Java programmers have even heard of (and even less have used) doesn't really anything.

    10. Re:What helps me by rabbit78 · · Score: 1

      It's not that this affects only two obscure classes. Such oddities are sprankled all over the API docs. And you can't speak of really good designed API either. But I must admit that their API docs and overall design are not that bad. I have seen much worse.

    11. Re:What helps me by jrumney · · Score: 1
      javax.swing.JViewport: "Hey we have a cool and fast implementation but won't tell you what a JViewport is".

      I don't know what version of the javadocs you are looking at, but in my version the first sentence of the class description tells you what a JViewport is.

    12. Re:What helps me by PastaLover · · Score: 1

      I think most projects have both. I'm currently using hibernate which has both an API reference and a 'reference guide', which I find a bit lacking here and there (I wouldn't have called it a reference guide) but it does the job.

    13. Re:What helps me by jnana · · Score: 1

      The Collections API, designed by Joshua Bloch (sp.?) is excellent, in my opinion and in the opinion of many others.

  3. Documentation formats by n1ywb · · Score: 2, Interesting

    You need to use a documentation framework to automate the process, unless your SDK only has one or two functions. I like Doxygen a lot, it's pretty easy to use and works with lots of languages. JavaDoc or PerlDoc, etc are good for specific languages. Html is a fine file format for the final output.

    --
    -73, de n1ywb
    www.n1ywb.com
    1. Re:Documentation formats by doctormetal · · Score: 1

      You need to use a documentation framework to automate the process, unless your SDK only has one or two functions. I like Doxygen a lot, it's pretty easy to use and works with lots of languages. JavaDoc or PerlDoc, etc are good for specific languages. Html is a fine file format for the final output.

      Html is nice, hyperlinked pdf is better. You can browse it on your computer and can also make printouts, which is nearly impossible with html documentation.

    2. Re:Documentation formats by Anonymous Coward · · Score: 1, Interesting
      PDF is awful. It's not cross platform, unless you mean that you can crash every platform that it supposedly runs on.

      I use Linux at work, and Adobe's version of Acrobat reader for Linux is several years out of date. It very frequently crashes X altogether.

      An open standard, like HTML (with intelligent CSS which will allow you to print well), is far better, and there is no reason that a halfway decent CSS guy can't make HTML look very good for printing too, and if that HTML was generated from XML, then it is easy to output the documentation in many other formats too.

      PDF is a dead end.

    3. Re:Documentation formats by doctormetal · · Score: 1

      PDF is awful. It's not cross platform, unless you mean that you can crash every platform that it supposedly runs on.

      I use Linux at work, and Adobe's version of Acrobat reader for Linux is several years out of date. It very frequently crashes X altogether.


      The latest linux version of the reader (5.0) is not the most recent, but it is not years out of date. And you are not bound to adobe's version. You counld also use one of the many alternatives.

      An open standard, like HTML (with intelligent CSS which will allow you to print well), is far better, and there is no reason that a halfway decent CSS guy can't make HTML look very good for printing too,

      Printed html pages is not the same as printed documentation. You will only be able to print seperate sections, not the entire documentation.

      and if that HTML was generated from XML, then it is easy to output the documentation in many other formats too.

      If you use an XML based format like docbook this is indeed true.

    4. Re:Documentation formats by Anonymous Coward · · Score: 0
      I tried to find when Adobe 5 was released, but had no luck. I know I've been using it for at least 2.5 years on linux.

      The problem with PDF is that, although there are alternatives to Adobe's reader, there are obscure features that only Adobe seems to implement. This is the problem with a proprietary binary format.

      Having said that though, I just noticed today that Adobe has apparently released a vastly improved 7.0 reader for Linux, so perhaps I can read *all* PDFs now without frequent X lockups.

    5. Re:Documentation formats by Anonymous Coward · · Score: 0

      You wrote that "HTML is nice, hyperlinked PDF is better."

      Do both. Doxygen is great at creating a fully hyperlinked HTML system at a price that is hard to beat (free).

      At about the same price point, there are tools available to convert HTML into fully hyperlinked PDF. I'm thinking its name was HTML2DOC or something like that.

      I was pretty successful with this only because I had tools for post-processing Doxygen's HTML (and the HTML from WebWork's Publisher/Mif2Go.) As a result, I knew the set of files and their order, so could put together on-the-fly the "configuration files" needed to do a PDF conversion.

      My post-processing tools were focused on taking out Doxygen's navigation (top) and copyright (bottom) and inserting my own. It turns out that this was useful in the PDF creation process, whereby I removed such navigation from the HTML used as source for the PDF and then inserted my own after PDF creation. Otherwise, the PDF was just too ugly with HTML navigation remnants.

  4. Who's your expected audience? by JavaRob · · Score: 4, Insightful

    Tough one to answer without more info....

    Is this an SDK for developers using your own invented language, with compiler etc.?

    What other language or environment is it most like? Those are the developers who will feel most comfortable developing with it, so you should model the documentation on standard docs for that language.

    General advice -- people learn new things best by doing them. Make sure your docs have a very quick intro to give developers the lay of the land and get them interested, then jump right into getting the full-source, good functionality demos running. The sooner I can create something actually useful to me (probably by modifying your sample app, not coding something from scratch), the sooner I'm hooked.

    Then to *keep* me hooked, you'll need a very thorough, easy-to-use reference -- both language elements and error codes/messages. It should have a good index, but also be organized well into good , fairly fine-grained categories (so that I can find what I need when I want to do X even though I don't know the function, etc.).

    1. Re:Who's your expected audience? by cerberusss · · Score: 1
      Make sure your docs have a very quick intro to give developers the lay of the land and get them interested

      Mod parent up. Whatever it is, it should pass The 15 Minute Test. Some developers may look at it in their spare time and there aren't a lot with enough patience to sift an hour through documentation before starting.

      --
      8 of 13 people found this answer helpful. Did you?
  5. Qt by Otter · · Score: 3, Informative

    TrollTech did a superb job with Qt. Excellent balance of documentation, examples, tutorials and overviews.

    1. Re:Qt by Brandybuck · · Score: 1

      I have to second that opinion. I have rarely, if ever, encountered that level of excellence in technical documentation. The fact that it is well formatted HTML (PDF available if you want to print it out) is a bonus.

      Of course, the documentation is matched with an equally good design and API. The same level of documentation wouldn't have nearly the effect if it were matched with Motif, for example.

      --
      Don't blame me, I didn't vote for either of them!
    2. Re:Qt by Anonymous Coward · · Score: 0

      I have to agree here as well. Qt is a prime example of excelent design and probably the best documentation I have had to deal with.

  6. Definitions AND examples by samjam · · Score: 4, Interesting

    You need good examples to SHOW what your definitions mean.

    You need good definitions and specifications so developers can extend the given examples to their own situation.

    Each new class of capability for a given module will need some examples. Too many trivial examples and not enough meaty examples driver developers mad with rage.

    If your SDK has well defined uses, tell a story of a developer writing and refining some code for a given purpose, so the reader can see how and why the more subtle points of the APIs are important.

    The PERL 4 Camel book is a good example of this.

    Sam

  7. Errors that mean something by ka9dgx · · Score: 4, Insightful
    If you return an error, make it unique for each actually error source. Resist the temptation to group all the errors together. NEVER us a "general error"... your code knows why it failed, its criminal not to return that information to the calling program.

    There's nothing worse that some of the BDE errors from Borland. They're misleading at best, and they lie sometimes.

    Remember - The true measure of character is what you do when things go wrong.

    --Mike--

    1. Re:Errors that mean something by 1000101 · · Score: 2, Funny

      BDE errors are terrible to say the least. Here is my favorite: $2E3B : Query makes no sense.

  8. Write 1 by brandonY · · Score: 2, Insightful

    Maybe I misunderstood, and you're writing SDKs for two seperate things, but I highly recommend against writing two seperate SDKs for the same system. It more than doubles the effort. If you need to give your corporate users more power, offer extensions to the original SDK, so that the two are the same except for one extra bit. That way, corporate folks can use the other stuff, and the other folks know precisely what they're missing.

    1. Re:Write 1 by Anonymous Coward · · Score: 0
      If you need to give your corporate users more power, offer extensions to the original SDK, so that the two are the same except for one extra bit.

      I would imagine that's what he means.

  9. Wiki... by dmayle · · Score: 4, Insightful

    One very bizarre, but incredibly helpful word for you: Wiki

    Even if you only do it in restricted form (verified commits on private site) you'll find that the volunteer work of all of your users will give you a much better final product than whatever you release. (Your users can even help out early of you do a release-early release-often model.

    You'll get to leverage the power of open-source (the community) because you have a know community already.

    On the same topic, something else you might want to provide are skeletons (working stubs that do nothing, but have all of the crap-work already done for starting projects), and a very simple, but fully functional project that takes advantage of the SDK, to show how you expect it to be used.

  10. WinHelp by hayriye · · Score: 1, Troll

    Of course, use WinHelp format.

  11. Slashdot standards? by gothzilla · · Score: 1

    What is the Slashdot recommended or preferred format for SDK documentation
    I didn't realize slashdot was a standards community.

    I've read documentation for more things than I care to think of. I've read them in html, pdf, txt, doc, wri, hlp, and plain old fashioned paper.
    I could care less what format the documentation is in as long as it's written well. Quit worrying about what format it's in and spend that energy making sure it makes sense and is readable. I'm tired of reading documentation that's written like I already understand the system and only makes sense after you know what you're doing. If I already understood the system I wouldn't need docs.

    Write some documentation that's understandable by someone who has no clue and you'll be set.

    1. Re:Slashdot standards? by smittyoneeach · · Score: 3, Insightful
      You can't write documentation without asserting something about the reader.
      Does "no clue" imply that this is the first time they've ever tried coding something?
      In this case, you want to write something gentle. The python tutorial is one notable example of what to do there.
      However, if you're talking boost, the 100-level stuff isn't going to win applause.
      One thing I haven't seen yet in this thread is the task-oriented, or 'cookbook' approach, that serves at least two distinct purposes:

      quick-n-dirty steps for the initiated

      nice feature overview, to highlight functionality you may not yet be using.
      Another thing unmentioned in the thread in indices. For documentation of size, the better the indices, the more useful.

      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    2. Re:Slashdot standards? by oojah · · Score: 3, Informative

      I felt this needed highlighting:

      I'm tired of reading documentation that's written like I already understand the system and only makes sense after you know what you're doing. If I already understood the system I wouldn't need docs.

      It's an excellent point - don't just document your API, tell us how to use it!

      Cheers,

      Roger
      --
      Do you have any better hostages?
    3. Re:Slashdot standards? by gothzilla · · Score: 1

      Just wanted to add some more after thinking about it.

      An SDK is not something used by the average person. You've got to already know at least some things before jumping into one. The SDK documentation should not worry about teaching people what an SDK is, but let people know how to use it. Explain what the different pieces are for and what they do. Give at least one example of exactly how to use it. Give a link or something to point people who need more info to another resource like forums or a mailing list.

      Just as an example. I bought a Fortinet firewall for the network I manage. I read the documentation several times, read the FAQ on the website, read the forums, and still had to call tech support with questions. I had to because the documentation was written for someone who already knew how to set up the firewall. Once I talked to support and learned how to use the more complex functions, the documentation suddenly made sense.

      Granted not many people RTFM, but some do, and some actually will spend a lot of time trying to learn something new on their own before making a phone call to your support team and costing you money. If the firewall docs had a few step-by-step examples then I wouldn't have had to call them. If the docs said "Fill in the field with this information which can be found here." then it would have been easy, but instead I got "Fill in these three fields here." Okay, I already knew that I had to fill them in, but fill them in with WHAT?

      I always liked the phrase monkey-proof. If you design something in a way that a monkey can learn to use it, you're fine. Just don't worry about the stupid monkeys. They'll cost you too much money and stress.

  12. You can't beat MS ADO for crap errors by Anonymous Coward · · Score: 0

    For instance
    Error: An Error Has Occured
    or
    Error: Unexpected Error

    Thanks for that, really fcuking useful!!!

  13. MSDN by Anonymous+Cowpart · · Score: 4, Insightful

    I must say that MSDN (Microsoft Developer Network) is a very good SDK,
    at least when considering the Platform SDK (albeit for a terribly inconsistent API).

    Search, Index, and cross-reference are all well-implemented, consistently formatted,
    and complete, and updated fairly often. Combined with a choice of format
    (HTML help or web browser of choice - even Firebird works well), it is a pleasure to use.

    1. Re:MSDN by Karma+Farmer · · Score: 1

      The .NET SDK documentation is quite good, also.

      At a minimum, recognize that the tutorial, the manual, and the reference guide are three seperate pieces of documentation. If you try to combine them all into one big document, I will hate you.

    2. Re:MSDN by AuMatar · · Score: 1

      At times its good. It has horrible holes though. The other day I was looking up the syntax of CreateThread. One of the parameters is a flag. There's no list of what the flag options are and what they do, and no link to a list of the options. I ended up throwing a 0 in there because I didn't know what else to do.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    3. Re:MSDN by The+Bungi · · Score: 1

      What part of this did you not understand? What's the parameter that is not documented?

    4. Re:MSDN by AuMatar · · Score: 1
      dwCreationFlags

      What are the list of supported flags, and what does each do? Here's the quoted text on that page:

      dwCreationFlags
      [in] Flags that control the creation of the thread. If the CREATE_SUSPENDED flag is specified, the thread is created in a suspended state, and will not run until the ResumeThread function is called. If this value is zero, the thread runs immediately after creation.

      If the STACK_SIZE_PARAM_IS_A_RESERVATION flag is specified, the dwStackSize parameter specifies the initial reserve size of the stack. Otherwise, dwStackSize specifies the commit size.

      Windows 2000/NT and Windows Me/98/95: The STACK_SIZE_PARAM_IS_A_RESERVATION flag is not supported.



      So apparently there's a CREATE_SUSPENDED flag, and a STACK_SIZE_PARAM_IS_A_RESERVATION flag. But thats not the complete list (I've seen other flags used). What other flags are available? If that is the complete list, they need to put it in a better format so you can tell what the list of flags is.
      --
      I still have more fans than freaks. WTF is wrong with you people?
    5. Re:MSDN by The+Bungi · · Score: 2, Informative
      I've been writing Win32 code for 10 years and I've never seen "other flags" used there. And STACK_SIZE_PARAM_IS_A_RESERVATION is rarely used because it's safer to just set the stack reserve in the app's image header, though that is supported under WinXP/2003. You usually use CREATE_SUSPENDED, and even that is rare.

      What other flags have you seen used?

    6. Re:MSDN by Anonymous Coward · · Score: 0
      You are missing the point. Documentation does not exist for you and people who've been doing Win32 for 10 years!!!

      You're saying that the documentation must be okay because you know the stuff that isn't in there.

      Well, I know the town that I've lived in for the past 5 years extremely well. Does that mean that maps for visitors don't need names on the streets?

    7. Re:MSDN by The+Bungi · · Score: 1

      You're just another Slashbot spreading FUD. I realize "OMFG TEH API DOCS THEY SUX AND M$ RUINED MY LIFE" bullshit goes a long way around here, but at least don't be surprised when someone calls you on it. There are a lot of things wrong with MSDN, but you picked the wrong one to bitch over.

    8. Re:MSDN by wwahammy · · Score: 1

      I think Microsoft does do a fairly good job with their SDKs. I've been trying to learn C# and its C# and .NET reference is good. I've only found two problems with MSDN's library:
      1. If you have no idea where something would be located in the library, you may be in for a long, long search. More than once I've searched for things and to me they weren't in very intuitive locations. That's an MSDN issue though, not necessarily indicative of SDKs in general.
      2. SDKs for MS at times will give awful examples. As someone who really learns new techniques by seeing examples, this can be very frustrating. When I was learning events and event handlers in C#, they had this example that I just couldn't understand. It was like they skipped the baby steps and just threw me into the deep end. (Wow, mixed metaphors...) They were trying to explain how to declare an event, create an event handler and the whole shebang in one example. I searched online for other examples and I found someone who split it up into a number of examples and I found that much more helpful. I guess it just means that when you write an SDK don't try to cram every possible bit of functionality into one example; split the examples up a bit so its easier for people get a handle on.

    9. Re:MSDN by Anonymous Coward · · Score: 0
      Do you know what FUD means? Hint: there is nothing in my post above that could be construed as FUD. I'm not the original poster, and I don't know if you're hallucinating, have mistakenly responded to the wrong post, or are just trying to throw in "FUD" to sound cool.

      Nice way to not address any of the points in my post and illustrate that you're one of the idiotic slashbots you're complaining about. I especially like how you found a way to throw in some l337 speak, even though it has no relevance at all to anything I talked about.

      If you read my post again, s-l-o-w-l-y, you'll see that I'm not making a point about MSDN or Win32 at all, but am commenting on your fallacious reasoning. Perhaps you could use a remedial reading comprehension class.

  14. Cross-language conversions by Arrowhead · · Score: 2, Insightful

    You haven't said which programming language the SDK is in, but one thing that makes a bad SDK is one that's a literal translation from an API in a different language.

    Case in point:
    A Java API for a commercial product is based on the earlier C API. All the magic handles are properly translated to objects, but sometimes the internals stick out. It has a method you can (or, as it turns out: must) call to set the character encoding the library uses to communicate with the server. This makes sense for C, which needs to be told, but if all of your Java API uses Strings, a method like this is nothing more than a please don't suck method you have to call, or things fail.

  15. A Tutorial for Absolute Novices by CompVisGuy · · Score: 1

    The single most important part of any SDK is a tutorial that is aimed at absolute novices. You must assume that your users will have had absolutely no prior experience with your SDK, with any similar SDK, or perhaps any programming language. The "Your First Cup of Java" tutorial is a pretty good example of what I mean.

    Your tutorial should be simple enough that the most stupid person you can ever imagine using your SDK will find it straightforward. Perhaps test it on a non-technical user like your mother or some kind of office clerk.

    You should try to minimise the length of time required to complete the tutorial. Less than an hour is good. The tutorial should let the user understand what your SDK does, how to start using it (including installing it), and what sort of things they can do with it.

    • If a user cannot install your SDK, they will never use it.
    • If a user does not understand what they must do "first", they will not be able to use your SDK.
    • If a user cannot see why they would use your SDK (particularly over another, similar product), they will not use your SDK.
    • If a user cannot afford the time required to learn your SDK, they will not use it.

    SDKs are boring. If you can make the user leave your tutorial with a smile on their face and a good feeling about your SDK, then they will come back for more.

    A good tutorial should leave the user feeling confident that they can go out into this new world on their own and survive. This can partially be achieved by concluding with a handful of good links that the user can follow to get more information. For example, give a link to a walkthrough of a simple---but non-trivial---application developed using the SDK. Give a link to the automatically generated API documentation. Give a link to a document that explains the architecture and overall philosophy of the design of the SDK. Give a link to some "do"s and "don't"s. Let the user know where they can turn for help from an actual person.

    --


    "The noble art of losing face will one day save the human race"---Hans Blix
  16. Required Logic should be outlined by topham · · Score: 1


    If your SDK requires a number of calls to set things up; Document them clearly with a diagram, flowchart, etc.
    And the recommended order of setup.

    Make sure the developer can differentiate between functions required Before something in initiated, or after.

    It can be really difficult to see the developers intent when you have to figure out if you can call a function yet.

    Nothing more frustrating than trying to figure out why something doesn't work when the code looks right, and the documentation doesn't say you can't call a function after a certain point (or before another) and you get nothing to indicate there is a problem, except it simply doesn't work.

    Example programs are nice, but they only show one way to do something; Often overly simplified. (Example programs are nice to prove a function/process works; if it fails to work I have to assume there is something fundamentally wrong.)

  17. You could... by fm6 · · Score: 1
    ...hire me (see below).

    Well, if not me, somebody else experienced documenting SDKs. Technical communication is a specialized skill.

    I'm assuming you're not a writer yourself, or don't already have one on staff. You didn't actually say.

  18. Documentation by rbarreira · · Score: 2, Insightful

    Make documentation in such a way that programmers which have already your API's before (or similar ones) don't have to read the whole manpage/docpage for a given function in order to know some detail.

    This might involve some redundancy, but I prefer it that way. For example, the good linux manpages are usually separated by sections (description, return values, etc). If I'm already familiar with, say, the recv call, I don't want to read through the whole manpage in order to know what the function returns when the remote host has shutdown the connection. I simply go to the "return values" section and everything is possibly repeated there.

    And the most important - don't let your documentation rot as the API is updated...

    --

    The AACS key is NOT 0xF606EEFD628B1CA427BEA93A9CA9773F
  19. Wiki is not a substitute for proper docs! by crimethinker · · Score: 1
    you'll find that the volunteer work of all of your users will give you a much better final product than whatever you release

    Few things are more frustrating than to go to the "docs" section of an F/OSS software project and find it's a wiki with lots of "TO DO" headings and no useful information. Here's a tip: if you don't provide any documentation, you won't have any users to volunteer their hard work documenting the code that you know a lot better than they do, since you wrote it.

    Now, wiki as a tool to organize and present the docs is another issue entirely. Wiki isn't bad, but simplying plunking down a start page and expecting users to fill in the details is not going to solve the problem of missing docs. You need to populate the wiki with useful information FIRST. And make sure that you offer an off-line version of the docs; some people rip PDF's to their handheld and read them on the bus/train while travelling to and from work.

    -paul

    --
    Pistol caliber is like religion: everyone has their favourite, and theirs is the only right choice.
    1. Re:Wiki is not a substitute for proper docs! by moonbender · · Score: 1

      The PHP reference documentation isn't a Wiki, but it has comments for every function. It shows both the goods and the bads, there are often important examples and information on bugs or odd behavious, but on occassion it's drowned by questions already answered 10 times etc. The goods outweigh the bads.

      --
      Switch back to Slashdot's D1 system.
    2. Re:Wiki is not a substitute for proper docs! by techcommdood · · Score: 1

      Though wikis aren't appropriate for final documentation purposes, I do think they'd be an excellent tool for collecting and hashing through information. The info gathered in a wiki will most-likely be a hodgepodge of conceptual, procedural, and reference info. You'll need to get your coin sorter out and dump the wiki into it to separate the content types and then use the result as the foundation for building your docs.

  20. Good analogies and metaphors by slimemold · · Score: 2, Informative
    Any time you are trying to explain something, you have to bridge the gap between what they already know and understand, and what they need to know and understand.

    When a programmer first learns about data structures, s/he might learn about "trees". Imagine explaining a tree without the implicit metaphor of roots, branches, and leaves. Sure, you could do it, but not without a lot of pain. Maybe it would be a "pointer-based hierarchical polyfurcating network of arbitrary data nodes".

    But it goes beyond just explaining the concept. If your analogy is any good, many items are, at a basic level, self-documenting. A debugger or profiler, for instance, uses the analogy of a VCR. You already know what the play, pause, and stop buttons are likely to do. You might consult the docs to see what exactly the difference is between pause and stop, but whatever it is it won't be a big surprise.

  21. My perfect SDK by Tom7 · · Score: 2, Insightful

    The perfect SDK, to me, has a "two faced" nature. The first face is a dumbed-down thing that makes it easy to get started, or to use some shallow function of the SDK as part of a project that's mostly focused on something else.

    1. It should be easy to do an obvious thing with the SDK, without reading the whole manual. ... it should come with an example, or set of examples, that compile right out of the
    box and are maximally simple. ... the interfaces should use base types as much as possible (strings, arrays of bytes,
    filenames) to make them easier to invoke, even if this is not general enough for
    all purposes. ... the user shouldn't have to install many dependencies for aspects of the SDK he isn't going
    to use.

    The second face exposes you to all the details, and the maximal generality. Here, reader and writer objects (or whatever is appropriate for your language) take the place of files and byte arrays, unicode support is standard, etc. Generally the first part is just stubs around this.

    In my opinion, there's no reason to provide middle ground, and it tends to clutter the interface.

    IMO, the SDL is a good example of a well-designed SDK.

  22. MySQL, and *use it* before publishing! by TTK+Ciar · · Score: 2, Informative

    I have often looked to MySQL's html documentation as a shining example of what documentation should be like. It has a pretty good API, too. I usually haven't the time to do a really knock-up job of my own documentation, but I do try to look at MySQL's for my general approach, including the format (html). Here's an example of some of my documentation. I borrowed some pointers from the standard UNIX man page format, too, because it's been in use for a long time and developed into something reasonably complete and useful.

    Another good example (imo) is the RFC which defines the NNTP protocol, rfc-977.

    Know your audience -- the HOWTO I wrote was primarily for nonprogrammers with rudimentary knowledge of UNIX command line use (waybackup's primary expected users), but also for programmers who might be trying to debug or extend my code.

    The most important thing with a SDK or any other tool, in my opinion, is use it a lot before publishing it, or even considering its development complete. Don't just come up with artificial examples, but actually use it internally to solve real-world problems. Your developers will unavoidingly find really annoying little problems in need of fixing, and come up with time-saving functions (perhaps just wrappers around already-existing API functions) which might need to be added to the SDK. Perhaps there's a function which seemed reasonable at the time, but in actual practice leads to runaway memory consumption. Maybe there are several functions which often get used together, but require the programmer to keep track of parameters which could get hidden internally instead. A nice long beta test, with the expectation of many programmer hours spent in reaction to user-reported errors/suggestions, is also often a good thing.

    In fact, as a programmer I usually tailor my development effort towards getting something minimally useful first, and then actually use it, and let my use define further development. Features that sound good "on paper" are often a waste of time to develop because they don't actually get used. Also, thinking real hard at code does not necessarily make it better than code which has been shaped by real-world usage.

    Anyway, I'll shut up now. Good luck with your SDK!

    -- TTK

    1. Re:MySQL, and *use it* before publishing! by Anonymous Coward · · Score: 0
      The most important thing with a SDK or any other tool, in my opinion, is use it a lot before publishing it, or even considering its development complete.

      I agree. Also have people who are unrelated to the development effort use the SDK given only the SDK and the documentation - no other form of information or help whatsoever. If they come back with lots of questions on how to make (whatever) work, that's a good sign that the documentation wasn't clear enough.

  23. man pages by fred+fleenblat · · Score: 1

    It's great having tutorials and references and pdfs and stuff, but I love being able to type "man functionname" or "man commandname" find out exactly how something is intended to be used. And the "SEE ALSO" section at the end is pure gold.

    1. Re:man pages by Anonymous Coward · · Score: 0

      Don't forget that the original man page facility was actually contained the entire Unix manual. With a few commands you could print it yourself including a TOC, all the pages grouped into sections with intros, and an index at the end.

  24. two kinds of code examples by dmh20002 · · Score: 1

    There are two kinds of code examples.

    1. simple examples that show exactly how to do one thing. keep it minimally sufficient.

    2. complete examples that pull it all together.

    Many Microsoft SDK sample sets include elaborate supporting infrastructure which means you have to figure the whole thing out in order to understand a single function. DirectX 9 SDK is a prime specimen. It has the type 2 examples, but no type 1 examples. You have to read hundreds of lines of code to learn how to do simple things. The directx 9 samples are an SDK on top of an SDK.

    Comer's INternetworking with TCP/IP volume III is another one on a smaller scale. In the parts about setting up simple TCP and UDP sockets, it builds an infrastructure that combines TCP and UDP, rather than just showing the steps for each socket type. Yea, it all looks pretty simple when you have been doing it a while but its hard for a beginner.

    I think its in the nature of programmers to fancier than they need to be, because thats the fun part. Sample code is one place you want to avoid that tendency.

  25. Provide a test harness by chriseyre2000 · · Score: 2, Insightful

    Provide a test harness (with source) that executes the api. Provide a debug stubbed version of the api that returns hints as to why the parameters failed. Be very clear on calling conventions. Who should allocate and free the memory. Be very careful when you pass out handles to records what they are for.

  26. DoxyGen by ulrikp · · Score: 1

    I can recommend Doxygen. It allows you to intermingle API documentation and code; you put a specially, but easily formatted comment in front of or behind each thing you want to document (class, method, member, #define, etc.), and then Doxygen extracts the documentation, producing a variety of output formats (HTML, LaTeX, RTF, PDF, and others). A lot like JavaDoc, and a lot like the Qt documentation as well.

    For HTML output, I'd recommend using a custom CSS stylesheet rather than the one provided, though. Fortunately, everything is CSS-enabled, so it's easy to change the look 'n feel.

  27. Discussion summary: 10 tips by Anonymous Coward · · Score: 1, Informative
    1. Be careful about how you name things. If you are writing .NET code, there are established guidelines. If not, you can use a general guide to naming things or, chances are your platform documentation has its own guidelines already. Don't waste your time trying to invent new ones, you'll simply confuse your users.
    2. Provide lots of examples.
    3. Use your own SDK! The best way to do so is to write unit tests. You can then most likely use a lot of that source code directly in examples, thus ensuring your examples always work. (minus the asserts and 'failure tests', unless you want to prove a point, etc.)
    4. If u kant rite professional english and complete sentences, hire someone who can.
    5. If possible, segment the reference for different classes of users: beginners who have never used your API and experienced users who are trying to squeeze it for what it is worth.
    6. Use appropriate tools (NDoc, Doxygen, RoboHelp, etc.), especially if you can create several output flavours (PDF, CHM, HTML, etc.) from a single input. Bonus points if it's part of the source code itself (i.e. as special comments) as there is less chance of a synchronization error.
    7. Hyperlink as much as possible. This will make easier for the user to discover features.
    8. Make it easy for your users to report documentation bugs. A Send feedback on this topic link at the bottom of each topic (like a lot of MSDN) is a great way to make sure documentation errors don't stay hidden too long, because incorrect documentation is worse than no documentation at all!
    9. Beware of pointless documentation such as: "The 'EnableJrtOutput' property allows you to enable the output of JRT." Explain what JRT is and why people would care to turn it on or off.
    10. Your documentation is as important as your code. It should thus be QA'ed (reviewed) as intently as the rest of your product. Don't put off documentation to the last minute.
    1. Re:Discussion summary: 10 tips by Anonymous Coward · · Score: 0

      > If u kant rite professional english

      no if u kant english foreign rite german. DUH.

    2. Re:Discussion summary: 10 tips by Anonymous Coward · · Score: 0

      Wow, point #9 brings back nightmarish memories of trying to read the java docs in the 1.0 and 1.1 days! It was filled with bullshit like that. Since it was just bullshit placeholder crap anyway, they may as well have just inserted "fuck you, figure it out on your own, we at Sun want you to use our new language, but we're so stunningly stupid that we can't be bothered to help you help us" everywhere. They basically said as much anyways.

  28. Use patterns! by don.g · · Score: 2, Insightful

    Assuming that by SDK you really mean "some sort of framework", you should read the Documenting Frameworks Using Patterns paper.

    The approach they describe works quite well, and is easy to do incrementally, and easy to use for developers. Of course, you still want reference documentation for individual modules/methods/functions, but that's not going to be much use by itself.

    --
    Pretend that something especially witty is here. Thanks.
  29. Layers? by Anonymous Coward · · Score: 0

    Apart from the things mentioned like documentation, examples, consistency maybe you'd like to build a layered SDK to make easy things easy and complex things possible.

    It's of course not very straight forward to get that right but your target audience increases. A tool i used years ago (LabView) did this to excess - not good IMHO, but maybe 2 layers would be good, depending of course on the overall complexity of your SDK.

  30. Tip by Anonymous Coward · · Score: 0

    One great combination is a Wiki, and doxygen for the code docs, class diagrams, etc.

  31. method use by dfj225 · · Score: 1

    I use docs generated by javadoc often, so I'm pretty happy with the format of the html generated by this program. Anything will do really, as long as it is easy to navigate quickly. However, the thing that is really useful is to be able to know what each method actually does. Describing how to use a method often leaves something missing unless you already have an expectation of how something will work. I find having examples of how some parts work together is a good idea. For a completely fake example, just knowing that connect() and init() are methods in the SDK, it might not be completely obvious that a call to connect() should always be followed by one to init(). I think you get the idea. When I read a doc, I want to know how something should be used, not just what it does.

    --
    SIGFAULT
  32. Get an outside opinion by chiph · · Score: 1

    Write some small part of your SDK documentation -- enough to illustrate various aspects of it. Then hire a senior-year university student for a few days to look at it, and explain it back to you. You'll be amazed at all the assumptions you made, that need to be explained.

    Bonus points for good samples. Get the college student to write them, and have one of your senior developers review them.

    Chip H.

  33. Examples and explain common uses of the API call by SKarg · · Score: 1

    The best documentation I read was from a Borland C++ 3.0 book which included a CODE EXAMPLE with every function.

    Better documentation explains why I would want to use the function/method and has common uses of the function/method.

    In the library code that I write, I typically write test-first programming, which serves as an API example of how to use the functions.

  34. SDK Docs by Anonymous Coward · · Score: 0

    The best SDK documentation are those written in plain English. Too many geeks developers write their code in latin haiku and expect everyone to be able to understand disconnected thoughts in a lingo that can only be understood if you created it.

    Best suggestions:
    1. Hire a writer to write documentation.
    2. Keep the docs simple and task oriented.
    3. Use Framemaker.
    4. Only allow the developers a technical review. Never allow them in a final review.
    5. Don't try an keep up with the Jones's when writing SDK documentation. Be unique, don't try to clone M$, Cisco, Sun or IBM.

    Cheers

    moc.oohay.cnihtt (-\-)

  35. set defaults automagically by Anonymous Coward · · Score: 0

    one thing i have not seen mentioned here (ok, maybe i overlooked it ;) is the importance of not terrifying users with thousands of settings; if there are possible default settings that make real sense set them up in the api if it is unlikely that users want to change these. at least i do prefer it that way; and alternative extended functions (for example) are much better.

  36. Some guidelines by QuestorTapes · · Score: 1

    Good documentation serves multiple different purposes. It should introduce new users to the tools, and assist them in answering the question, "is this the right tool for my needs?". It should help the user to understand how the tools work. It should give practical examples of how to perform various tasks. It should serve as a definitive function reference for skilled users. And it should be easy to search.

    The first, introduction, requires a good table of contents, and some good overview and structural documentation. This cannot be automatically generated, and should not usually be written by the developers. The skills involved in good technical writing and good coding don't usually overlap that well.

    The second, understanding, is an extension of the first. It should blend practical, real-world-type examples with subject-by-subject introduction and overview. The purpose here is not to teach "how to do [blank]" so much as to explain enough of how [blank] is done to allow readers to start putting the pieces together for themselves. Some tasks require contra-intuitive setup and tear-down, or an understanding of how the setup and tear-down tasks are intended to function.

    The third, practical examples, can be partly automated. Two warnings:

    1: Real code isn't necessarily the best example. Often, real, production code has dependencies or compromises that makes for over-complicated examples. Have a non-techie read it for sense.

    2: Keep examples small but complete, and include the values of parameters where possible. I recently saw a fully accurate example for a vendor's API that was absolutely useless. Four of five function parameters were either custom format strings of bar-delimited command sequences, and nowhere were there examples of format strings or valid commands. The example was something like: "ExecPFECommand(fs, cs, ....), where fs is a valid format string, cs is a valid command string, ..." Accurate, but not worth the space it took up.

    Fourth, a definitive reference, should be automated as much as possible. Keep in mind that real-life function names and parameter names can be cryptic. If they are, fix them up or alias the formal parameter names in the documentation to something meaningful. It's got to be correct; that's why so many people want to automate this kind of documentation. Beware of things that can trip up automated documentation generators. Sometimes developers add extra parameters to functions, for "the next version". Document that they are unused. If they must be NULL, then document that as well. Sometimes features are removed in non-obvious ways. Consider an API with an object that implements a printf() style formatted output function. Suppose a developer originally intended to support all the printf format-codes, but later they reduced this to a subset. Remove the references to format codes/options that the API no longer respects.

    Fifth, search ability, is critical. This involves more than just having a decent search engine; you also need a human being to identify keywords and tag pages in the documentation to build high-quality indexes.

    A few additional points:

    Keep terminology consistent and avoid generic terms with existing meanings. Example: same vendor as above, used the terms Object and Entity in non-standard ways in a system using both objects and a relational database. Better to either qualify the term (PFEObject and PFEEntity, for instance), or come up with something else.

    Watch out for cruft in function, variable, object and structure names. If you're lucky, it would be no worse than the Afx-prefixes all through Microsoft's MFC libraries. If you're not, you end up adding more people to phone support to explain defects in the documentation.

    Plan for obsolescence. If various interfaces aren't really generic, don't pretend they are. You didn't mention languages, so I can't be specific. C++ for instance would let you use namespaces for multiple versions. But you might want to encode the application version in the names. But you might want to encode the application version in the function and type names. It's ugly, but it does work. And most people here would rather have "ugly but works" over "attractive, but breaks often".