Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
In Re^2: beginner Rpg/Mud, I criticized the code for PerlMUD as being buggy and having about 300 style violations. In a /msg discussion that ensued, sauoq argued that there is no community style guide, outside of what the perl interpreter will accept as legal. As my update to Re^2: beginner Rpg/Mud states, I agree with him, on the face.

However, I would like to put forward that there are commonly accepted standards, usually promulgated by the elders of the community at large (like merlyn, TheDamian, and others) in various media (like books), that set the expectations of the average Perl programmer. These standards are closely related to, but not identical to, the standards put together by the venerable K&R for C. These standards are also those which McConnell (in Code Complete) and others in numerous books on programming theory (such as the Gang of Four in the Patterns book) have used in their examples. By constant repetition, I would argue that these standards-in-print should be considered the de-facto community style guide, to be used as the basis for specific organizational style guides.

My argument is, in my mind, bolstered by my experiences as both a Perl consultant and as a CPAN author/contributor. I have worked nearly exclusively in Perl at 9 different companies in 6 different states over the past 10 years. In addition, I have 4 distributions on CPAN, have contributed patches to at least 2 dozen others, and have read the source for dozens more. All of that code over all those years from all those authors has, for the most part, looked very similar. They have been so similar that I have both come to expect certain ways of writing things from well-written Perl code. In addition, I use the existence of other modes of expression as red-flags that I have to examine this piece of code more closely for the existence of bugs and/or design flaws.

I'm wondering:

  • Do you feel the same way?
  • What items do you unconciously look for as signals that what you're reading merits a closer look?
  • Are there items that make you feel more comfortable with the code?
  • Do you feel you can rate the experience level of the author by how the code looks, both in Perl and programming in general?
  • Has your style changed as you have improved as a programmer, both in Perl and in general? If so, how?
  • Do you think that the style of a piece of code can contribute to its maintainability?
Please note that I'm not proposing the creation of a community style guide (though I wouldn't be opposed to one). I'm also not talking about indentation levels, camelCase, or cuddled elses. I'm talking about more fundamental things, like
  • Do you indent at all? If so, how?
  • How do you write data structures? How do you access them?
  • How do you structure your logic?
  • How do you call your subroutines?
  • What kind of naming conventions do you use?
  • What do you consider worth putting into a subroutine? How do you structure them?

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

In reply to Commonly accepted style guide? by dragonchild

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 scrutinizing the Monastery: (9)
    As of 2014-12-18 23:51 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (69 votes), past polls