3 ms·
Every time this subject comes up, a pack of vociferous compulsory commenters come out and start shouting about how desperately unprofessional it is not to write
by frobozz 16y ago
Every time this subject comes up, a pack of vociferous compulsory commenters come out and start shouting about how desperately unprofessional it is not to write comments.
I imagine, also, that a fair collection of idiots also start using it as an excuse not to bother commenting their illegible code, but they seem to keep quiet about it.
The author points out that "Sometimes you just need to leave a note", but that doesn't stop people coming out and declaring it "the most retarded article ever". These are people who can't tell the difference between "Never write comments" and "Write clean code to avoid the need for comments".
Even as I write this, I imagine some of them bursting a blood vessel because "You can't always avoid comments".
I agree, you can't. If (for example) you are authoring some workaround for a counterintuitive 3rd party API, then yes, good commentary is important.
However, if you write short, well-named, DRY, SRP-obeying units, with well named parameters and variables, and well-named, clear tests, then many of the comments that you find in poorly written code simply aren't needed any more, because they are there in the code itself.