Rocky Bernstein has been working a new Perl debugger called Devel::Trepan. I came across some discussion in a git pull request for this project a while back and I’ve been thinking of this blog post since that time.
Rocky has his own unique coding style. It’s not too out there. There are some truly oddball styles on CPAN. But there a few oddities that stand out. First, he puts various
use lines before the package declaration. He also uses prototypes completely pointlessly (prototypes on methods do absolutely nothing). He also likes to combine several statements onto one line, like:
use strict; use warnings;
use strict; use vars qw(@ISA); @ISA = @CMD_ISA;
Besides the prototype issue, none of these are wrong (and the prototype thing is arguably intended as documentation). The code works as written, and the meaning is more or less clear.
But it’s weird, because it’s not what most people other do. It’s a unique snowflake.
It’s a distraction.
Instead of looking at the code, experienced Perl programmers will spend time going “WTF” and wondering why this code looks different from all the other code they’ve seen.
If you’re writing code that you’d like other people to work on, please don’t write unique snowflake code. Every moment someone spends being a bit confused by your unique style is a moment that they’re not spending improving the code. It’s time they’re not spending fixing bugs, adding tests, writing docs, or adding new features.
One might argue that we should just accept the oddities but it’s often hard to distinguish between a style and code which changes a program’s execution.
Please pick from one of a few standard styles (2- or 4-space indent, braces in a sane place, one statement per line, package comes first, etc). Include a perltidyrc that contributors can use to match your style. If your style can’t be recreated using perltidy you’re probably writing snowflake code. Please don’t. It’s just code. It’s not that special. Save the unique snowflakes for your symphonies, sculputures, and sonnets.