6 ms·
Until the code changes, then the comments are usually worse than nothing
by cush 5y ago
Until the code changes, then the comments are usually worse than nothing
- AlotOfReading 5y agoI've seen this counterpoint brought up many times before, but I'm struggling to think of the last time I experienced it. Is it really a common problem for you?
- cush 5y agoYes, the issue isn't that most comments are inaccurate, it's that the inaccurate ones are so costly. When the comment doesn't match the code, it makes you question the code and the intent. 90% of the time, comments are accurate or just redundant (the code is descriptive enough), but that 10% of the time when the comments says A and B is happening, I end up chasing down whoever or digging through changelogs and tickets to find the comment wasn't updated.
- taneq 5y agoThen you fire the coder who changed the code without updating the comments?
- kwhitefoot 5y agoThat's a waste. Just train them better.
- cush 5y agoMost code doesn't need comments.
- benrbray 5y agoNo. Comments are like a parity check. If the comments don't match the code, then you know that either: 1) The comments are correct, but the code is wrong. This is a bug. 2) The comments are wrong, but the code is correct. This is equally a bug. Whoever makes the change has an obligation to describe their changes with a comment. Code with no comments? Could be right, could be wrong, who knows?
- b3morales 5y agoFor the kind of code comment we started this thread talking about (explaining why some simpler/more obvious process is not used), this seems vanishingly unlikely.