Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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

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
    [marto]: good morning all

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (8)
    As of 2018-06-20 08:35 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (116 votes). Check out past polls.