Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

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

I disagree with you here.

Comments have one big advantage over the code: they are written to be read by humans. And they are usually on a higher level of abstraction.

I sometimes have to read through thousands of lines of code in search for an error. And that is usually code I have never seen before, but where I only have a rough idea what should happen. So I pass through the code, and focus on reading the comments - till I find possible locations of the error. Only then I look at the code of these locations in detail. Typically, I then compare the code of the "probably error location" with older versions of the same file - and also focus on the comments first - to get the idea why something was changed.

The approach above works well most of the times.

Of course that the depends on the quality of the comments. They need to give you an idea what the coder wanted to do. There are many types of comments that are useless ... possible you, BrowserUk, are referring to things like

if ($i > 0) # check if $i is greater than zero
which I agree to be harmful: they waste time and give no benefit - and even worse(!): they create the mentality of "comments are useless" in the mind of some developers. I hate reading their code ;-/

Sometimes code and comments are not aligned or even contradicting. In my experience, those places are more likely to contain errors than others: it is a sign that a developer made some change in a hurry - and if he had no time for adding a comment, he probably hadn't time to think deep enough on the side-effects of the change (and most probably the code was not reviewed either ...). So even outdated comments are (in some kind) helpful for finding errors...

All the best, Rata (who thinks comments are a really useful "tool")


In reply to Re^2: On comments by Ratazong
in thread On comments by pemungkah

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, 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?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (4)
    As of 2020-02-22 07:45 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      What numbers are you going to focus on primarily in 2020?










      Results (98 votes). Check out past polls.

      Notices?