Re:Types of Comments to Avoid Making when Programming
by joe_the_user on Sunday July 25, 2010 @03:47AM
(#1545157)
Hmm,
One interesting thing is that out-of-date comments may tell you that whoever last modified the code didn't know what they were doing.
Re:Types of Comments to Avoid Making when Programming
by ajuc on Sunday July 25, 2010 @06:49AM
(#1545343)
I find it easier to remember to add meaningful comment to commit (we have commit hook that prevents you from commiting without comment), than to remember to change every comment in source code that I touch (especially if it is far from the lines of code I changed - eg in the class header, or in the header of the base class when I only change some method in derived class). Commit messages tells me on each line, why it is here (we have policy of adding JIRA task number to the commit message).
What does bug me are: 1) Out of date comments. I hate when comments say one thing, but clearly the code has changed and the code now does something else.
2) Comments lacking context. I've seen things like, "exception only occurs when persisted"... what's persisted? I don't see how any exception occurs here. It's until an hour later can I find what they're referring to.