Since I started with the D language (which I really find a great language), I once again noticed how documentation is either lacking, hardly accessible, badly written or computer generated. At least one of these options is true for most (hobby) projects, and also for D libraries (as they're pretty new). But also for my own large project I've been struggling and delaying to get the documentation coming.
I would like some input and advices / examples on what you find good strategies to document code. Good ways to make it accessible, readable and usable. There are several examples I have an opinion about though, it would be great to hear from other people what their experiences are with the different techniques, what worked well, what worked not...
Here is a list of methods I encountered and have a biased opinion about:
1. Automatically generated documentation. Often done with certain (like Java) style comments in the code. Then by running an application such as Doxygen over your code, it barks out a complete website with all classes, functions, constants, etc. covered. Each with some notes from the documentation in the code.
From my personal experience I find this technique deficient. It requires programmers to consistently add comments in the form of documentation to their code. This makes the code unreadable. Code is code, it can contain comments, but not documentation.
When using computer generated documentation as a user, it's often tough navigating. And the notes are poor and insufficient.
2. Unix manpages. Separately written, often very basic HTML with mono-spaced fonts. It has a list of links to all functions (it's often only for C libraries). Each function has one page with headers such as: Name, Synopsis, Description, Examples, See also, ...
I find this very clear. It exactly states what the function does, how it is called, how it is used and what related functions are. It often gives an adequate understanding about the usage. However, more often then not, it is written by the programmers themselves. This can result in documentation for the team (people who are familiar with the library) and not for foreigners (people who want to get familiar with the library). Besides, I haven't thought of a way to document more object oriented languages; documenting modularized functions (in namespaces / classes).
3. Wiki's. Often written by the community or a few advanced users / team members. Has pages with many interconnections with other pages, often written as tutorials or articles.
Most often very inconsistent in style and manners. Lots of information is added by different individuals, sometimes uncategorised (just dumped in one file) or too few / too much information. Many navigation possibilities to other pages, sometimes losing track or finding duplicated information. When done right, can be a very good medium to set up articles / tutorials, for references guides not so sure.
4. Custom made; good, bad or ugly.
Personally, I find unix manpages very clear and complete, but sometimes asserting that users are already familiar. Also, I'm not too sure how to document object oriented / modularised code with unix manpages. Wiki's can be very nice for articles or tutorials when set up right. I'm not a fan of community driven wiki's, as it takes time to maintain and the result is more often then not a collection of inconsistent pages.
What are your thoughts? Which method do you use (or which have I forgotten)? Which method do you find effective, and which embarrassing?
Any input is welcome, thank you!
PS.: sorry for the long post