Re: comments (was Re: A critic of Guido's blog on Python's lambda)



Ken Tilton wrote:

Absolutely. When I take over someone else's code I begin by deleting all
the comments. Then I read the code.

Is this a great programming tip I've never heard before? Or
a mere joke?

Somewhere in between. I do not recall ever sweeping through an entire
code base deleting all the commnets, I just delete them from stretches
of code on which I have to work so I can see the damn code.

Somehow I thought you wrote that you delete code without reading
them. But you didn't. It was in my head.


Recall that most people write borribly, and that natural language is
anyway naturally ambiguous. Note also that comments do not run, code
runs. Comments do not always (often? ever?) get maintained. Some
comments state the obvious, especially for folks from the
comment-every-line school, and do no more than obscure the landscape.
Finally, if I am now the maintainer of a project, guess what? If there
is any non-obvious code I need to understand it, and, yeah, I know how
to read code.

Code only tells what it does. Sometimes it doesn't tell (or is not
obvious) why it does what it does.

Recently I put lots of comments to explain why those ugly codes are
necessary -- it's because of buggy API calls. (They are not my faults.)
And you delete them? I weep. You must give me a chance to explain!


As I said, if the code is not readable, rectification of
names is an entertaining and insanely productive way of studying code.
Just reading it puts one to sleep.

kenneth
.



Relevant Pages

  • Re: comments (was Re: A critic of Guidos blog on Pythons lambda)
    ... Is this a great programming tip I've never heard before? ... I do not recall ever sweeping through an entire code base deleting all the commnets, I just delete them from stretches of code on which I have to work so I can see the damn code. ... Finally, if I am now the maintainer of a project, guess what? ...
    (comp.lang.lisp)
  • ID this anthology
    ... There may also have been one or two Heinlein stories in it. ... Another about a four-dimensional house. ... I do not recall any further stories, but there must have been more than those five. ... I started reading English in 1989, so the book can't have been published as 1st edition after that date. ...
    (rec.arts.sf.written)
  • Re: Seven Entries
    ... My scart TV was already six years old before DVD came out. ... I'm one of many who stopped reading all magazines on a regular basis. ... time reading your posts and watching you wriggle around as others pointed ... ....I also recall an excellent website that someone did where he listed all ...
    (uk.media.dvd)
  • Re: Need help choosing a novel to read
    ... but reading his novels isn't going to push my Japanese ... can't recall the Japanese title - "Chinmotsu"? ... but I can't recall about the language itself. ...
    (sci.lang.japan)
  • Re: Buyer wants a refund...
    ... >> heard of you (that I recall). ... > haven't been reading the group all that well. ... not noticed Mr. Parry (perhaps he needs a more memorable tag). ...
    (uk.people.consumers.ebay)