I think commenting code is important, but if I read between the lines and apply some of my own way of thinking I can agree with this post on the following merits: Ok so what about comments that *should* be in the code? The WHY you did that comment. I think these are far more valuable then explaining WHAT is being done. For example, in some resent code I was working on I had some trouble with rand not really being so rand so I looked up the function and read up and saw that I needed to add the srand function to get better results. I need to document the srand function call as to WHY I added it so that time isn't wasted on relearned by me or learning by someone else as to why the srand function is needed to correct a problem under a particular condition.

Commenting also adds to the learning process. When you comment WHY you did something you reinforce what you have learned and how you applied what you learned.

In short I agree with Revelation's argument if I interpet the type of commenting he wants to avoid correctly.

In reply to Re: Commenting One's Code In A GNU/GPL/OpenSource World by trs80
in thread Commenting One's Code In A GNU/GPL/OpenSource World by Revelation

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.