[net.misc] Self-documenting code???? Shesh!

jimv (06/13/82)

First, where are you drawing your line between comments being
necessary and not being necessary?  You seem to think that 3 line
programs do not need comments, but 4 liners do.  Perhaps 10
lines may not need comments?  How about 100?  Clearly lines
of code is a meaningless measurement.

But that is not the real point I want to make.  You are neglecting
the importance of the ABILITY to read code.  I feel that that is
at least as (if not more) important to be capable of reading code
as it is to be able to write code.  From a code maintainer's
standpoint, that is what it must always come down to.  From the
viewpoint of a person writing new code, it is imperative that they
be capable of drawing upon the wealth of information available only
in code.  (For example, imbedded in Knuth's MIX algorithms are
valuable coding hints and content not otherwise apparent.)

Truthfully, I have not seen any indication that programmers
are any better at descriptive prose than they are at coding.
It seems to me that a programmer's task is primarily one of
organization.  If a programmer cannot organize his thoughts
in the framework of a computer language so that all revelant
information is readily available, what makes you think it
will be improved by apologizing for the mistake in English?

Don't misread me.  I am not claiming that comments are
useless, but instead that comments are not "the" solution.

	Jim Valerio  (sdcsvax!jimv)

mark (06/14/82)

While it is certainly important to be able to read code, comments are
still crucial in programs of any size.  In practice, of course, most
programs are quite large.  When a change needs to be made, it's most
often a trivial change of a few lines.  The problem facing the person
who must make the change (usually not the author) is FINDING those
few lines that need to be changed.  Also, this person must figure out
enough of the conventions used in the program to be able to make the
change.  There are two ways to get this information out of the program:

(1) Read and understand the code.  Most of it is irrelavent, but must
    be read and understood to determine that it can be ignored.
(2) Read the comments.  Good, high level comments at the front of
    programs, modules, procedures, and chunks of code are much faster
    to read than code, and make it faster and easier to find the
    appropriate place in the code.

Of course, if the program fits on your CRT screen or on a page of line
printer output, it may be as fast to read the code as to read the
comments.  But how many programs are this simple?  The real problems
are with the huge software systems that nobody knows every line of code.

steveg (06/16/82)

C, Pascal, Ada, etc. are not self-documenting languages.

But how about this for a wish list item: Code that one can read.

Afterall, one can express cooking algorithms in terms of a "formal"
recipe language. Why not a general purpose language which is as
readable?

(don't go overboard on the cookie recipe analogy, and start complaing
 about things from net.cooks that you couldn't do; It is only an
 illustrative metaphor)

					- Steve Gutfreund