"And then, the code changes but the comment doesn't. Now its downright misleading."
Sorry, that's just a failure of the programmer, same as any other coding mistake they may make. It is by no means a reason to not have comments.
Sorry, that's just a failure of the programmer, same as any other coding mistake they may make. It is by no means a reason to not have comments.
Having essentially the same code written in two places (code and comment) absolutely BEGS for them to get out of sync. Its why we write modules, subroutines etc - get it right once.
Comments are evil if they mention the code. They should be about constraints, the compiler, your wife, ANYTHING but the code.
This isn't double documentation -- it's complementary documentation. Code is the what, comments are the why. If one does not match the other, then again, that's on the programmer.