| [reply] |
... read the comments and decided if they matched the code.
And that's exactly what is wrong with relying upon comments to make your code understandable.
Comments cannot be tested.
If I have to mentally run the code in order to decide if (my interpretation of) your comments seems like maybe, could be, if I squint and ignore the typos and grammatical errors and constant changes between first and third person narrative, might actually be correct, then I what? Save myself the effort if having to read the code.
What else?
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
| [reply] |
And that's exactly what is wrong with relying upon comments to make your code understandable.
Comments cannot be tested.
Sure they can. You read them and see if they work, i.e. increase your understanding. If they don't, then you need to fix them -- that's actually part of the job of a maintenance programmer. Though you should probably also ask yourself if they might increase the understanding of someone else working on the code (introspection alone isn't enough).
(Note that if you're really in the habit of developing patches with copies of code with comments stripped, then when you port your fixes back to the original, there's a real danger that you're going to introduce code that's not in sync with surrounding comments... you're punting on the problem of communicating with future programmers).
| [reply] |