I think comments within code are often a waste of time, at least
in high level languages. The code expresses the ideas logically
and unambiguously, which is much harder to do in a natural
language. If the functions and variables are given sensible
names, their meaning is usually clear enough. (Writing comments
or documentation outside of a program could be useful, however,
for example in giving instructions about how to use a class.)
Whenever I've had to understand someone else's code, the first
thing I do is delete all the comments because they are usually
just clutter. For example, I've seen the following:
# Open the data file and print the data:
open(DATA,$datafile);
print <DATA>;
# Now close the file:
close(DATA);
or
# For each element in the list, do something to the element:
foreach $element (@list) {
DoSomething($element);
}
I wrote comments in a Perl script recently because I wrote it
for someone who doesn't know Perl but wants to learn. That was
the first time I've written comments for a good reason. Other
times it was because some manager decreed it.
Where I work now no one writes comments, probably because
the managers are programmers so they know it's a waste of
time.
pc
At 1:44 PM +0100 10/4/02, Lindsay Marshall wrote:
>I cannot but comment on comments and Dereks comments. Let me raise my
>"programming is a craft" argument and suggest looking at other
>disciplines. How many other craft disciplines have secondary notations
>of this kind? (Thought clearly the interesting about programming as a
>craft is that the individual product gets replicated many times which is
>not usually the case). Think about buying a violin and then taking to
>another instrument maker for repair. Where are the comments that help
>the repairer maintain the instrument? (Such as what kind of glue has
>been used etc.) Painters do leave comments in that they *sometimes* do
>preliminary sketches and models etc.
>
>Anyway, I'm sure Derek will now comment on my comments on comments.
>
>L.
>
>- Automatic footer for [EMAIL PROTECTED] ----------------------------------
>To unsubscribe from this list, mail [EMAIL PROTECTED] unsubscribe discuss
>To join the announcements list, mail [EMAIL PROTECTED] subscribe announce
>To receive a help file, mail [EMAIL PROTECTED] help
>This list is archived at http://www.mail-archive.com/discuss%40ppig.org/
>If you have any problems or questions, please mail [EMAIL PROTECTED]
- Automatic footer for [EMAIL PROTECTED] ----------------------------------
To unsubscribe from this list, mail [EMAIL PROTECTED] unsubscribe discuss
To join the announcements list, mail [EMAIL PROTECTED] subscribe announce
To receive a help file, mail [EMAIL PROTECTED] help
This list is archived at http://www.mail-archive.com/discuss%40ppig.org/
If you have any problems or questions, please mail [EMAIL PROTECTED]