As with most things in software development the ultimate currency for comments is time. This is an analysis of the costs and benefits of comments.
I’ve spend too much time in code written by authors who drank the “every comment is a failure”-Kool-Aid. Then, one day, I exploded and told the world to comment their fucking code!
This rant sprouted surprisingly many fruitful discussions about the topic and even though the fronts are still hardened, it feels like they are less so. I explored the topic in a series of posts and came to a simple and pragmatic pattern of when and how to write and maintain clean comments.
Feel free to hire me as a trainer if you would like me to enrage your developers with my crazy theories.
To discuss the up- and downsides of comments we need to know what exactly we are talking about. Categorizing and characterizing different kinds of comments is an important preparatory step.
Matt Werner from DZone interviewed me about my stance on comments.
My rant to comment your fucking code sparked some interesting conversations. Here we discuss some of your and my thoughts on the topic of comments.
You think your code is so clean that it doesn’t need comments? Then this rant is just for you!