|
This is personal, but I taught myself how to code, before the internet, and with barely any books. One thing that made, for example, the PHP documentation a lot easier to read vs. Perl was: examples On an API level, don't just explain what things do, but how to use it, what is the intention behind a particular call or method, and how it integrates with other pieces of the environment. If there are best practices, this is the place to call them out. And it does not need to be a tutorial, but if the class calls for a "usage sample", that is perfect for the documentation. Pick on these:
1) What decisions did you take for the implementation?
2) What tradeovers are made (this is written like this because ...)
3) How is it supposed to be used
4) What is the common pattern for accessing the resource (instantiate it, factory, singleton, dependency injection?)
5) How does it relate with the rest of the codebase? Now, this is PHP, but on other languages...
6) Is it Thread-Safe?
7) How cheap is it to instantiate a new object of that type? |
I've also noticed a lot more packages (npm mostly) with synopsis sections which essentially forms a 'full example', I find these immensely helpful.