Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Thanks for the comments.

It appears there is little common ground on which to base a discussion, but since you picked out two examples, I'll address those briefly, and then not waste any more of the monks' time.

For me, the writing of comments is part of the thinking process. The comments you commented on were (if memory serves) written before the code, as I was sketching out what needed to be done. I agree that comments that do no more than repeat what the code says are not only redundant, but can simply be clutter (except where the code is particularly tricky) -- for me the key is to concentrate on the "why". Though I do find it useful to use comments to point up the stages that a block of code goes through.

The first comment you picked out:

# Reverse sort the set and partitions and insert sums
served several purposes: (a) it was a stage in the subroutine; (b) the algorithm used depends on stuff being reverse sorted, this is key to understanding what is going on; (c) it's doing something a little tricky: in the resulting array entry 0 is not the same as the other entries, it's the sum of those entries. While I was writing it, I thought about all this... I suppose I could have written a longer comment to emphasise the key points...

The other comment you picked out:

# Done -- return partitins in required order
(sorry about the spellin error)... well, yes, it's not the most significant of the comments in a 2,800-odd line module. Again, the subroutine was broken into stages, so this also serves as the end of the previous stage. The order in which the partitions are returned is key -- the caller can (and does) depend on this.

As it happens, there are three similar subroutines, with the same general shape, and the comments emphasise that. You've commented on the smallest of the three, where there is less to comment on.

In reply to Re^5: Why no comments? by gone2015
in thread Why no comments? by targetsmart

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (3)
    As of 2020-10-26 16:24 GMT
    Find Nodes?
      Voting Booth?
      My favourite web site is:

      Results (252 votes). Check out past polls.