in reply to Re: No Comment
in thread No Comment

It sounds like you think comments are there to benefit people who are new to programming, or at least new to Perl. The problem is that these types of comments are incredibly distracting once you actually know the language, and at that point they just take up valuable screen real estate that could be filled with code. In most development situations, you should assume that the next person to read the code will be reasonably competent. If not, they have bigger problems than just dealing with your program

Replies are listed 'Best First'.
Re: No Comment
by cLive ;-) (Prior) on Apr 24, 2003 at 08:28 UTC
    I disagree - I comment heavily on what I was thinking at the time. It has little to do with the actual code, and more to do with intentions:
    # we know this is coming from XXX because of sub xxx, so we don't need + an extra taint check here
    etc. I can go back to code I wrote only a week ago that I've already forgotten (small buffer :) and have trouble going through it quickly unless I do this.

    But then. maybe I'm just dopey :)

    .02

    cLive ;-)

      No, you don't disagree, at least not with me ;) I think your example is an excellent example of a useful comment, because it's about the why of the code, not the what.

      A good trail of thought, but will the comment still apply if sub xxx is changed 6 months down the road by someone else? I prefer to describe this kind of thing with assertions instead - "executable comments", as schwern calls them in the description bit for Carp::Assert. This has the added benefit of making sure that changes that disturb such dependencies and implied relations don't slip by.

      Makeshifts last the longest.

Re: Re: Re: No Comment
by Nkuvu (Priest) on Apr 23, 2003 at 22:34 UTC

    To tell the truth, I never really considered why I should add comments. It was just drilled into my head that I should.

    And once I start thinking about why I should comment things, I can see that I've been going about it all wrong.