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

Re: 78/80 chars perl line still a meaningful rule

by Ratazong (Monsignor)
on Oct 16, 2012 at 09:58 UTC ( #999271=note: print w/replies, xml ) Need Help??

in reply to 78/80 chars perl line still a meaningful rule

Hi McA!

Despite having not only one, but two wide monitors, I still think its a good idea to keep lines in code short. That does not mean a hard cut on 80 characters, but to take care that it is not much longer. I have the following reasons

  • I prefer reading "top-down" to "left-right" ... and that includes code
  • my screen is usually filled with windows, so its good to have them side-by-side and still being able to see all of the code
  • in some rare cases I print code ... and then I have a limit of characters per line (otherwise it looks akward...)
Am I just too old-fashioned?

HTH, Rata
  • Comment on Re: 78/80 chars perl line still a meaningful rule

Replies are listed 'Best First'.
Re^2: 78/80 chars perl line still a meaningful rule
by grizzley (Chaplain) on Oct 16, 2012 at 10:16 UTC
    ...and e.g. file comparison tools, which I use often to see what has changed. Two code windows side-by-side mean 160 characters already.
Re^2: 78/80 chars perl line still a meaningful rule
by Anonymous Monk on Oct 16, 2012 at 19:48 UTC

    Not to mention, the optimal width for reading prose is somewhere around 60 characters per line. The eyes don't need to track so far back when they reach end of the line and so on. (I'm sure there's research on this I can't bother to conjure up right now.) (See also: newspapers, magazines. They break their text into columns, too.)

    Usually when I need to print text, I print two pages per sheet (A4) just to get the line lengths to something satisfactory. It also tends to save a bit of paper...

    Anyway, code. My stance is that you can't achieve clean code unless you keep your line length under 80 characters. The widescreen monitor argument? Either put multiple code listings side by side, or pivot your monitor. 10:16 or 9:16 doesn't seem so wide anymore, does it?

    (...those cheap monitors that use TN panels don't pivot so well...)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://999271]
[abner]: what if i want SELECT * FROM charge WHERE col1 = x and col2 = y?
[atcroft]: abner: So you are wanting to do something like my $sth = $dbh->prepare(' SELECT * FROM charge WHERE col1 = ? and col2 = ?;'); $sth->execute(' asdf', 'asdw');?
[atcroft]: (Full disclosure: I may have the idea right but small typographical errors, so please test any code I suggest. :) )

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2017-01-24 03:57 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (202 votes). Check out past polls.