Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Comment on

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

I don't suppose you'd feel like posting your coding standard here? I'd love to pick it over :)

The trouble with coding standards is that they all too often become sticks for keeping the serfs in line in surrogate fiefdoms. One man decides that his style is the standard and everyone else must adopt it. The assumption being that cos he's the boss, he knows best.

Somethings code standards can mandate are Good Things:

  • smallest scopes for local vars;
  • contextually meaningful variable names;

    $i is fine for a (numeric) loop counter (preferable to $persons_array_index_counter), but not so good for a instance attribute or global variable.

    And yes; there are rare occasions when a global variable makes sense.

  • proper (and consistent) indentation;

    No flattening of the structure just because one guy grew up with, and never got over, 70 column listing paper and ADM3+ terminals.

  • consistent use of whitespace--horizontal as well as vertical;

    Spaces around operators vastly improve readability.

    No cramming everything together just in order to comply with an antiquated width restriction.

Conversely, I've been subjected to some horrible "standards": 2-char indentation; Hungarian notation; Camel_Case_Plus_Underscores; mandatory 24 line block comments for every function or method; and many more.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re: Why Create Coding Standards and Perform Code Reviews? by BrowserUk
in thread Why Create Coding Standards and Perform Code Reviews? by eyepopslikeamosquito

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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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 rifling through the Monastery: (12)
    As of 2014-09-19 17:35 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (143 votes), past polls