The Art of Code Comments
css-tricks.com
css-tricks.com
Sometimes I find it useful to add a comment of the form "this function is called by that function" to the called function.
An editor that let you mark comments as explaining how, explaining why, identifying further work that needs doing, etc. and then filter out the irrelevant ones would be nice.
It ought to be that we could attach a comment to a specific expression, rather than just sticking it nearby.
I hadn’t really thought about it much before. But since then, I see lying comments absolutely everywhere. Many of which I have written myself. The author is right, comments are really hard to maintain.
Nowadays I try my absolute hardest to avoid writing comments. 9 out of 10 times, it can be solved with some refactoring.
Code should strive to be as self-documenting as possible but there will always need to be some level of documentation- and good comments are part of that.
One other part of that effort should be good unit, integration, and acceptance, tests.