Essential elements of good documentation
sohamkamani.com
sohamkamani.com
I think this is often bad advice. It's too easy to find documentation of this sort that misses out describing key aspects of how the software actually promises to behave.
For example, you might have a graphics library with lots of functions for creating pens and coordinate systems and so on, all meticulously documented, and then one "render" function with a brief description that tells you what the return type is, but no description of (say) the layering or composition model, because that doesn't belong to any one function.
Instead, I recommend starting by documenting the key behaviour of the program, describing its model of the world and defining terminology, and only then trying to document each function in terms of that model and terminology.
That is, the first duty of technical documentation is to be complete and correct (at least for practical purposes). Once you've got that far it's time to pay attention to optimising it for the needs of your likely readers.
Can you explain in more detail how that's different from the approach described in "What nobody tells you about documentation"? [0] At first blush, your recommendation sounds pretty similar to what is suggested in that post.
Is this a critique of the guideline to "Give reference documentation the same structure as the codebase" that was in [0], or is it more like you think the importance of the "Explanation" section is underrated?
(This is coming purely from the perspective of somebody who is trying to write better documentation. I'm not trying to defend any particular stance, just interested in your opinion.)
One is:
- A: a list of functions or similar items, vs
- B: a description of a model, its operations, and terminology
The other is
- X: "the only job is to describe, as clearly and completely as possible", vs
- Y: "a chance to relax and step back"
My reading of the "what nobody tells you" article is that it envisages a reference which is A and X, and an explanation which is B and Y.
I recommend that the reference should be A, B, and X. Having an explanation which is B and Y is a fine thing too.
So basically the bit I don't like in that article is where it says the reference should not attempt to explain basic concepts. Maybe it doesn't need to try to teach concepts, but it very often does need to define them.
(Also, I think rationale fits well in the "describe as clearly and completely as possible" document, especially if you're in a position to separate it a bit from the main text.)
See also this previous comment of mine about a common pitfall of reference documentation: https://news.ycombinator.com/item?id=20473713
The more systematic approach which I've really caught onto recently is to assume it has to be atomized a bit to get any breathing room. Make distinct spaces for the narratives, spaces for basic concepts and references, spaces for formal overviews, and spaces for single tasks, features and APIs. Then have them link to each other, using the link as the leverage to let each part of the documents use the necessary vocabulary without overexplaining. While it's possible to overdo that and produce documentation that is a thicket of links, just clarifying that you have a distinct purpose to the space makes the writing process much more systematic - no confusion over what the writing needs to concentrate on.
Every major system for converting function documentation to code has a slot for documentation at the top of the module/package/class/whatever. I find this is very underused, almost across the board. I actually quite like automatic documentation, on the provision that you put something decent at the top for people to orient with.
I prefer the more general approach to documentation given here: https://www.divio.com/blog/documentation/
This starts right from the first sentences describing the tool. I am a particular fan of people who don’t hide the purpose of the tool behind several lines of adjectives and credits. The Redis description in the article is exemplary, IMHO.
It'll vary from project to project depending on the audience. There's no such thing as definitively "good docs" that would work for everyone, but you certainly can make good docs for a given project if you know what your audience needs. Ask that question first.
I know it's not quite your point, but the article http://stevelosh.com/blog/2013/09/teach-dont-tell linked elsewhere (https://news.ycombinator.com/item?id=21339009) proposes:
> The purpose of technical documentation is to take someone who has never seen your project, teach them to be an expert user of it, and support them once they become an expert.
1) "negative space": tell people also "what it's not" to avoid misconceptions
2) keeping documentation updated with code
discuss! :)