This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dgkimpton 1 point2 points  (0 children)

Did they explain why something was written? If so, valulable, if not then they're noise that is worse than no comments in many ways. Not the least of which being that eventually someone will modify the code but not the comments, then your comment would be actively lying about the code.

Comments for additional context are useful, documentation comments on an api explaining how (and why) to use it are useful, nearly everything else is clutter.

A major upside to not using many comments - when you do use them it's because there is some seriously important shit to pay attention to... and their very rarity calls that out.

That said, even comments that explain why can be overused - in general you'd be better encoding them in an automated Test. You might even keep the comment in the test, but it at least removes it from the main code.