2 ms·
That’s indeed a problem. However, writing no comments can also be a problem, so one has to find a compromise. I think comments are helpful given these two crit
by starbugs 3y ago
That’s indeed a problem. However, writing no comments can also be a problem, so one has to find a compromise.
I think comments are helpful given these two criteria are met:
* The comment is concise.
* The comment reveals something that is not obvious in the code that follows immediately after.
It is then also easier to spot and fix outdated comments.
A typical problem that I have encountered with the “no comments” approach is that developers then have to name stuff. And naming stuff is hard. Writing a sentence is much easier. This can be a bigger issue than an outdated comment.
As an example, I just reviewed a code base and found a class named “CaptionSubtitles”. It had a comment, but that also suffered from a language gap. I think this is an issue that is widely overlooked. Code expresses semantics, so names matter. A comment can in this case at least hint at a concept or thought that the original author had in mind who of course left a couple of years ago.