Archive for the ‘Perl’ Category

PBP: 017 Non-Terminal Expressions

Thursday, June 26th, 2014

This Best Practice is one that I’ve seen people argue horribly about, and I don’t get it.  The suggestion is to avoid doing a big calculation, with sequences of complex operations, in the middle of  a statement.  Take that complexity, stick it in a variable, and use the variable. (more…)

PBP: 016 Breaking Long Lines

Monday, June 23rd, 2014

This Practice is about how to break long lines of code.  It suggests breaking them before an operator, so the operator serves as a visual cue on the left, where you’re likely to be reading, that this line is continued from last time.

(more…)

PBP: 015 Vertical Alignment

Thursday, June 19th, 2014

The Perl Best Practices suggest to align things vertically.  They like to apace things out into neat rows of equals, fat commas, braces, and parenthesis.  Columns of data, when it will fit, are also approved of. (more…)

PBP: 014 Elses

Monday, June 16th, 2014

The PBP suggests that you don’t “cuddle” an else.  This means that the else and it’s opening parenthesis starts on its own line: (more…)

PBP: 013 Chunking

Thursday, June 12th, 2014

The suggestion in this one was very simple, “Code in paragraphs.”  Deceptively simple, because it means different things to different people. (more…)

PBP: 012 Blocks

Monday, June 9th, 2014

The Best Practices tell us never to place two statements on the same line.

In general, I agree with this, and find it a workable thing to do.  There’s a few cases I forget, or decide not to.  In most of them, it comes back to bite me later, and I wish I’d listened.

At the end of the day, I like whitespace, so yes, use a new line.

 

PBP: 011 Tabs

Thursday, June 5th, 2014

The PBP suggests using spaces to indent all code lines, instead of hard tabs.  The hard tab character should appear nowhere in a file.

I disagree with this, but have given up the argument and simply do it anyway.  I feel it a minor loss, and not worth the confusion it causes from people who don’t understand hard tabs. (more…)

PBP: 010 Indendation

Monday, June 2nd, 2014

The PBP suggests using four space indentation levels.

The book goes into many reasons for this.  It suggests that I’m an “ancient coding master” because I learned with eight columns, and find that a perfectly acceptable number.  Cue; GET OFF MY LAWN!  =) (more…)

PBP: 009 Line Lengths

Thursday, May 29th, 2014

The PBP suggests using a 78-column line length.

I’m good with this.  I don’t feel the need to be a pedant about it, but I like the idea in general. (more…)

PBP: 008 Commas

Monday, May 26th, 2014

The suggestion is to put a comma after every value in a list, even the last which doesn’t need it. (more…)