Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hello, my name is Nkuvu, and I'm addicted to comments...

I'm a prolific commenter, particularly in Perl. But I also know that I have to maintain the comments (usually) more often than the code itself. And it should also be noted that the people who are reviewing my code aren't Perl proficient. So I comment Perl-specific operations, to help the reviewer see what I am doing -- why is usually obvious (but documented if not). For example, if I have ($foo) = $bar =~ s!\\!/!g; I'll comment on it. Because you don't see things like this in C/C++.

It was also hammered into me throughout my university career that comments are good, lack of comments is bad. Period, no flexibility in that conclusion. But I can see all of the points that other monks have made, and resolve to comment less in the future. Most of my code is very similar to C/C++, due to the people I'm working with. And I can't assume that the person who maintains my code will be a Perl programmer.

When I started with Perl, it was to update a script written by a no-longer-present programmer. He had very poor style, with variable names like $l (that's an ell) and $x throughout the script. I could have killed for comments in his code, especially since I didn't know Perl. So I've kind of overcompensated since then.

I suppose I shouldn't admit that one of my scripts (which has a complicated algorithm) is over 50% comments...


In reply to Re: No Comment by Nkuvu
in thread No Comment by awkmonk

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-03-29 10:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found