Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I have a unique problem as a coder. I have a lousy memory. Terrible. For some reason, I can remember the names of singles by obscure punk rock bands, but the proper placement of the comma in an open statement refuses to settle into my brain.

Frequently, I have to revisit code I wrote a year or more ago, and figure out what it does and why it isn't doing it anymore. Ergo, I'm comment guy. Each subroutine I write has a profile at the top something like this:

#--- # sub get_build_from_server # Takes: server_name, password, path_to_build # Returns: 0 for pass, 1 for fail # Called by: main # Calls: &parse_build_name #---

The essential concept is to insure that I won't have to spend a lot of time figuring out what a sub does. If I do something "clever", I put in comments explaining why. A few times, I've gone so far as to include the chapter in The Camel Book/Perl Cookbook where the concept was discussed. Also, if the main chunk of code is a loop, it helps to list the exit condition at the top.

You might also find the Perl Programming guidelines/rules thread instructive.

"What do I want? I'm an American. I want more."

In reply to Re: IYHO, what do you consider good code? by logan
in thread IYHO, what do you consider good code? by stonecolddevin

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 all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (6)
    As of 2018-03-24 20:11 GMT
    Find Nodes?
      Voting Booth?
      When I think of a mole I think of:

      Results (299 votes). Check out past polls.