in reply to Re: On comments
in thread On comments

I both agree and disagree. I notice that the more experienced a programmer is, the more useful the comments in the code are.

A good programmer codes in a way that comments on how the current code works doesn't need any comments, nor do the variable names or their purpose(s).

What does need comments is the reason why the current code uses a specific algorithm or - maybe double as important - why a certain other, maybe more obvious, algorithm was not used.

Those are the most valuable types of comments in code IMHO. Even if the original reason turns out not to be true after 15 years of hardware development or different compiler optimizations.


Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^3: On comments
by BrowserUk (Patriarch) on Dec 20, 2010 at 09:08 UTC

    If you look above, I was very careful to say "(Most)"; and "Some comments are useful.".

    My contention is that they are far rarer than most people believe. Please also see Programming *is* much more than "just writing code".


    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.

      I didn't miss that. What I'm (also) trying to say is that (new) programmers have to learn along the way what comments are most useful 5 years from now. When you start programming, you have a really wrong approach in that aspect learned at school.


      Enjoy, Have FUN! H.Merijn