Speaking of source code comments, antirez (of Redis fame) wrote a fantastic article[0] about that topic some time ago and I still recommend it to colleagues whenever they make the hollow statement that "code should and can be intelligible on its own, without any comments". [0]: https://web.archive.org/web/20210226004600/http://antirez.co... (I still don't understand why he deleted his blog)
- * Function comments - * Design comments - * Why comments - * Teacher comments - * Checklist comments - * Guide comments - * Trivial comments - * Debt comments - * Backup comments
"
I tend to write 'debate comments' of the software that I write for my own business (sole proprietor). I think they fit the 'why' category above.
I often doubt my own decision making process, so I tend to write it out in comments, so that I can I can see reasoning.
My general challenge with comments is of 'maintanence'. The tools to maintain comments, cross link them across diagrams or other hand-written documents -- are hard to find.
So am gradually switching to my own directive that 'all documents about implementation, the API and their usage, are to be generated from my comments'.
Again, not a lot of tools that I found in this area, but at least it is possible to write my own tools (using IDE APIs) in this area.