in reply to Re: The art of comments: (rave from the grave)
in thread The art of comments: (rave from the grave)

A perfect program needs no comments at all.
I disagree on this. Readability should be one of the main target of a perfect program, and comments are an important part of it. Good comments let you better understand the main blocks, the purpose of the different functions (even "private" methods, whose commenting is useful to let someone hack on it) and basically leave the possibility to modify the code. To add new features, of course, because it's perfect.

Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Don't fool yourself.
  • Comment on Re^2: The art of comments: (rave from the grave)

Replies are listed 'Best First'.
Re^3: The art of comments: (rave from the grave)
by tlm (Prior) on Jul 08, 2005 at 00:32 UTC

    A perfect program needs no comments at all.

    I disagree on this. Readability should be one of the main target of a perfect program, and comments are an important part of it.

    I think the point is that a "perfect program" is so inherently clear that comments are unnecessary. Of course, there's no such thing, but the point is that, in the opinion of some, comments are often (ab)used as a substitute for clear programming.

    the lowliest monk

      At the risk of being pedant, but inherent clearness for me actually means that the program is perfect because it's doing nothing. I can understand 30 lines of code, with input and prints, not being commented; OTOH I would be disappointed of a 1000 lines program lacking them.

      Moreover, maybe a perfect program needs no comments - but surely an imperfect programmer needs them to understand it :)

      Flavio
      perl -ple'$_=reverse' <<<ti.xittelop@oivalf

      Don't fool yourself.