The Best Perl

zen-1038363__180

The Perl language does not get enough respect these days. Newer languages like JavaScript, Python or Clojure get all the attention. But Perl is still in use almost everywhere, for many types of programs. It is powering the web at many  sites, including ZipRecruiter, PriceLine, TicketMaster, and DuckDuckGo.

Perl is good for rapid development. One reason is that there are many contributed modules are available, for just about any task you could imagine. Have a look at CPAN, the Perl module directory, containing more than 100,000 modules.

Suppose you have a bit of Perl experience and are starting a larger enterprise app. How do you choose among the thousands of Perl modules and frameworks? Suppose you Google a bit. Some of the best and newest modules will not be on the first Google page, because the best module authors are not necessarily SEO experts. Google will lead you to modules which look good at first blush, but do not have complete tests, or which depend on new versions of Perl, or have ‘hidden dark corners’.  You could get bogged down in Google results by the large quantity, the wild diversity, and the varying quality. Where do you start?

This is where Kensho becomes handy. It is a guide that recommends frameworks. There is a concise list of the best 5 database frameworks, the best 12 Object Oriented modules, the best 8 unit testing frameworks, and so on. 100 recommended modules in all.

For example, if you are planning an enterprise web site, look at the web development category, which lists app frameworks. In this, Catalyst is a mature project. Mojolicious is almost as mature, and is a large project with many features. Dancer2 is newer, and is quite different in that it is a DSL on top of Perl. Dancer2’s author had experience with the Sinatra framework. Your code will be concise, but at times  you will struggle to know what is happening behind the DSL facade (compare this with Rails in the Ruby world).

Now, look at the Object Oriented programming category.  You could structure your project based on the Moo or Moose object oriented frameworks. Your choice might be constrained by your choice of web app framework. If you use Catalyst, your OO will be Moose, and if Dancer then OO will be Moo with perhaps a bit of Moosex.

Likewise, testing frameworks can be constrained by previous choices.

The Kensho list is somewhat personal, being the preferences of Chris   Prather (PERIGRIN) (the originator) and Karen Etheridge, who is one of the most committed members of the Perl community. If you have used Perl, you have probably used one or many of the modules she wrote or maintains.

What’s the Kenshō 見性 name all about? From Wikipedia: “Kenshō is an initial insight or awakening, not full Buddhahood. It is to be followed by further training to deepen this insight, and learn to express it in daily life.”

So, before you start coding, have a look at the recommended frameworks, and structure your project better. There Is More Than One Way To Do It (TIMTOWTDI) but in most cases There Is A Best Way To Do It (TIABWTDI). And maybe TIMTOWTDI is one of Perl’s weaknesses! It will trip up the maintenance programmer, who may have to learn a new programming style with each project.

Many thanks to Gabor Szabo for corrections!

Better Programmer

Becoming a Better Programmer, Pete Goodliffe

New programmers will benefit from reading this book, and applying its recommended development practices. It is important enough that I will claim that your career will taken to a new level. My experience working with many programmers is that at least half of them needed to adopt the practices covered by this book (not you of course!).

Experienced programmers will get a queasy feeling, knowing they have cut some corners to get code delivered a day or so earlier, and that it will come back to bite them soon.

This is not an Extreme Programming (XP) book, though the author seems in favour of XP. It is more about how to program, design, and test well. I particularly liked the explanation of Technical Debt, which other books and blogs mention without explaining.

Read the e-book on the bus to work!