in reply to Re^5: knowing your audience
in thread Programming *is* much more than "just writing code".

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).

Replies are listed 'Best First'.
Re^7: knowing your audience
by BrowserUk (Patriarch) on May 09, 2007 at 18:40 UTC
    Sure they can. You read them and see if they work, i.e. increase your understanding.

    Hmm. A comment that might increase my understanding when I write it, may not do so for your understanding when you read it.

    It might help Fred, and leave Bill cold, whilst leading Harry right off down the garden path. It all comes back to the imprecision and variablility of interpretation of natural language. And that's before we get into the realms of social and cultural differences.


    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.

      Hmm. A comment that might increase my understanding when I write it, may not do so for your understanding when you read it.

      It might help Fred, and leave Bill cold, whilst leading Harry right off down the garden path. It all comes back to the imprecision and variablility of interpretation of natural language. And that's before we get into the realms of social and cultural differences.

      Yes, precisely. Working with other human beings is a pain, isn't it? Everywhere you turn, you're stuck with a certain amount of imprecision, even in questions like "does this code work?".