A Checklist for Writing Maintainable Perl

| 3 Comments

Suppose you want to write a program in Perl. (Suppose you have written a program in Perl.) If the thesis behind what I call Modern Perl is correct, you can write that program well or you can write that program poorly. (For supporting arguments for that thesis, see Piers Cawley's A tale of two languages.)

Likely you've seen examples of Poorly Written Perl on the Internet. They serve as the YouTube comments to Nabokov of English language. In other words, the proper response to a reluctant admission that:

Yes, I know that Perl can be written in an object-oriented and readable way.

— Tim Bray, D.P.H.

... or that:

There's also been a push in some applications to rewrite Perl utilities in Bash to enhance portability between platforms. While Perl exists on just about every platform out there, there are vagaries that can cause issues with differing Perl versions, which then leads to portability problems.

— Paul Venezia, Is it still libelous if you end your titles with question marks?

... the proper response is "Why didn't you write your code with maintainability in mind?"

I know, I know. That's not helpful. Here's a quick checklist to help those of you writing Perl (or those of you trying to hire people to write Perl (or those of you trying to hire people to learn to write Perl)) to determine if you're capable of writing Perl well:

You don't have to answer all of those questions in the correct way to write good and maintainable Perl, but if you answer most of those questions in the wrong way, of course you'll write bad code.

Perl allows people to accomplish their tasks without having to learn much, without having to participate in strange and unfamiliar ceremonies, and without even being much good at programming at all. That's by design, and that's a good thing for very specific circumstances. Yet if you approach programming as if it were merely typing and retyping until something barely working fell out of your typewriter, you're going to make lots of messes, and no language can save you from an unprofessional lack of discipline.

Writing good code requires discipline in any language.

3 Comments

Unfortunately Taint works less than it should because so many people don't use it.

Can you write another post on answers (i.e. pattern and practice) on your own questions? Thanks.

I was inspired by your post to go see if there's a local Perl Mongers group here (I live in Buenos Aires, which hosted the first regional PyCon in South America a couple of years ago). It looks like there used to be, and their web site is still up, but the last meeting listed on their web site was in 2007. So, I signed up for their mailing list, in case they're just not updating the web site. I'm not optimistic, though.

When you say, "Have you enabled strictusers", what does "strictusers" refer to? Did you just paste the word "users" after "strict" by mistake?

By the way, your configuration of Movable Type sucks. Trying to comment with JS turned off gave me enigmatic "Invalid request" errors.

Modern Perl: The Book

cover image for Modern Perl: the book

The best Perl Programmers read Modern Perl: The Book.

affiliated with ModernPerl.net

Categories

Pages

About this Entry

This page contains a single entry by chromatic published on July 26, 2010 9:53 AM.

The Best Art Continues to Surprise was the previous entry in this blog.

How About a Shetland Ponie? is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.


Sponsored by Blender Recipe Reviews and the Trendshare how to invest guide

Powered by the Perl programming language

what is programming?