Comments Are More Important Than Code

Hi,

I don´t think that comments are useless but I do think that in most cases they can be made redundant by better code or unit tests. Would you care to provide some examples where this is not true?

···

Stephen Kellett <snail@objmedia.demon.co.uk> wrote:
In message <20050428203052.4537.qmail@web32207.mail.mud.yahoo.com>, Lorenzo Jorquera writes

How will you know if it's the test or the code that's broken? Without
comments in the_func telling you why that exception is raised, you
could end up fixing the wrong problem.

When you run your unit tests very often (tipically several times an
hour) you will know exactly why the test failed.

Wrong answer. You still are not documenting the "why".

Comments tell you what the code *SHOULD* be doing, not *WHAT* it is
doing. So many people responding to this thread seem oblivious to this
obvious, yet subtle and important fact.

Stephen
--
Stephen Kellett
Object Media Limited http://www.objmedia.demon.co.uk
RSI Information: http://www.objmedia.demon.co.uk/rsi.html

---------------------------------
Do You Yahoo!?
Todo lo que quieres saber de Estados Unidos, América Latina y el resto del Mundo.
Visíta Yahoo! Noticias.

At what point did such a claim become fact? As much as I may believe
in and hype my development practices and philosophy, I'm not going to
claim that they're fact. Other ways of doing things exist... Some of
them just aren't very efficient.

But you're claiming this is a "subtle but important fact?"

Please try not to confuse your preferred development philosophy with
fact. It isn't good for this discussion. The fact that we can even
have such a heated debate over comments should tell you that no one
here is 100% right.

···

On 4/29/05, Lorenzo Jorquera <lorenzo_jorquera@yahoo.com> wrote:

Wrong answer. You still are not documenting the "why".

Comments tell you what the code *SHOULD* be doing, not *WHAT* it is
doing. So many people responding to this thread seem oblivious to this
obvious, yet subtle and important fact.

--
--
Dave Fayram (II)
dfayram@lensmen.net
dfayram@gmail.com

Dave Fayram wrote:

Comments tell you what the code *SHOULD* be doing, not *WHAT* it is
doing. So many people responding to this thread seem oblivious to this
obvious, yet subtle and important fact.

Please try not to confuse your preferred development philosophy with
fact. It isn't good for this discussion. The fact that we can even
have such a heated debate over comments should tell you that no one
here is 100% right.

I don't think he's talking about development philosophy; it looks like what he's saying is "Comments tell you what the programmer thinks the code is doing, not necessarily what the code is actually doing.", which actually is a fact.

It's an almost cliche saying among coders that the computer will do exactly what you tell it, not what you think you tell it. The comments document what the programmer thinks he told the computer.

···

On 4/29/05, Lorenzo Jorquera <lorenzo_jorquera@yahoo.com> wrote:

Dave Fayram wrote:

Comments tell you what the code *SHOULD* be doing, not *WHAT* it is
doing. So many people responding to this thread seem oblivious to this
obvious, yet subtle and important fact.

Please try not to confuse your preferred development philosophy with
fact. It isn't good for this discussion. The fact that we can even
have such a heated debate over comments should tell you that no one
here is 100% right.

I don't think he's talking about development philosophy; it looks like what he's saying is "Comments tell you what the programmer thinks the code is doing, not necessarily what the code is actually doing.", which actually is a fact.

No, it's not. Comments tell you what the programmer thought the code should be doing when he wrote the comment. Not all programmers keep the comments and code synchronized.

It's an almost cliche saying among coders that the computer will do exactly what you tell it, not what you think you tell it. The comments document what the programmer thinks he told the computer.

...at the time he wrote or last modified the comment.

Jim

···

On Apr 29, 2005, at 7:40 PM, Pete Elmore wrote:

On 4/29/05, Lorenzo Jorquera <lorenzo_jorquera@yahoo.com> wrote:

--
Jim Menard, jimm@io.com, http://www.io.com/~jimm/
"The theory of computation states that all automatons can be emulated
by a Turing machine. I have a less abstract but more practical motto: If
you can do it on Intel, you can do it damn near anywhere!"
     -- Eugene O'Neil