Skip to main content

Timeline for "Comments are a code smell"

Current License: CC BY-SA 2.5

5 events
when toggle format what by license comment
Aug 23, 2011 at 21:13 comment added Anthony Pegram On the other hand, the comments might only tell you what the code was supposed to do as of the time the comments were written. The code itself may be telling you what it's supposed to do now. Comments don't compile. You can't test comments. They may or may not be correct.
Feb 28, 2011 at 6:55 comment added Danny Tuppeny "If you read some code and think it does X when in reality it does Y" That's not what I said. I'm talking about understanding what code does do, but not what it's supposed to do. Let's say you suspect an off-by-one error. How do you know the off-by-one error isn't in the consuming code instead or this code? Comments explain the intent of the code, which helps enormously with tracking down bugs.
Feb 27, 2011 at 15:36 comment added Adam Lear Unit tests help a lot to determine if the results are wrong. If you read some code and think it does X when in reality it does Y, then it's possible the code isn't written in a readable enough way. I'm not sure what you mean about the results being used incorrectly. A comment will not protect you against someone consuming your code in strange ways.
S Feb 27, 2011 at 15:13 history answered Danny Tuppeny CC BY-SA 2.5
S Feb 27, 2011 at 15:13 history made wiki Post Made Community Wiki