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

Comment on

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

It's a simple question, with, for me, a complicated answer. It boils down to

  • Make the code easy to read and comprehend;
  • Make the code easy to maintain; and
  • Make the code easy to print out.

Reading and Comprehension are important points: if there are multiple lines much longer than 80 characters, the eye can't take it all in, and the head has to move as well. The eye's visual acuity is actually quite limited, but the brain does an excellent job of pretending that it's better than it is. As the line of code gets longer, it gets harder to find where the beginning of the next line is.

Maintaining code, once you comprehend it, is vital. And it could be that you're not on your favourite workstation with multiple gigantic screens -- you might be limited to a 25x80 screen. Having long lines cut off or wrapped can be quite irritating. (I've just been working on some scripts within Jenkins, editing in dialog boxes, and it's difficult to see where a line is a continuation.)

Getting a hard copy of your code can be quite useful -- but that's for naught if the print function either cuts the long lines or wraps them where you don't want it to. It's much better to do your own wrapping (I use gq{ in vim, for example) and have it display and print out correctly. Yes, the file will be longer -- too bad. :)

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds


In reply to Re: 78/80 chars perl line still a meaningful rule by talexb
in thread 78/80 chars perl line still a meaningful rule by McA

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 contemplating the Monastery: (13)
    As of 2014-10-21 10:43 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (100 votes), past polls