Higher Order Perl (and Javascript / Ruby)

Tweet

Currently juggling about 15 bookmarks in a copy of Higher Order Perl by Mark Jason Dominus. Just a mini-review – for a more detailed review try here.

From the inside cover…

As a programmer, your bookshelf is probably overflowing with books that did nothing to change the way you program… or think about programming.

You’re going to need a completely different shelf for this book.

Not sure if that’s understatement or overstatement. Anyway – it is an excellent book; most of all as a middle ground for stepping into functional programming but Mark’s (I assume) background in mathematics makes for a very refreshing break from web frameworks and CRUD, with some really interesting problem domains. Mark explained his “hidden agenda” here.

It’s not all mathematics though (in fact it mainly isn’t). For example the chapter on parsing is one of the most accessible and useful I’ve seen on the subject (excepting perhaps Game Scripting Mastery, oddly enough) – Chomsky grammars don’t even get a mention ;)

Otherwise there’s a bunch of techniques and ideas that are applicable pretty much anywhere and may turn your head if you’re used to thinking in terms of classes and objects, such as using a hash table to dispatch calls while parsing a configuration file.

Some of the examples in later chapters get pretty hefty (hence the bookmarks) so be warned – you need some undisturbed time to get the most out of it.

Of course the pre-requisite is familiarity with Perl, and here the book isn’t taking many prisioners. But there the good news is, if you don’t know Perl; the code from the books examples have been translated twice – first to Javascript by Sean M. Burke (as in him that I ripped off) and again to Ruby by James Gray. That someone went to the trouble should give you an indication of how good it is. You’ll still need the book for the explainations but learning some Perl along the way can’t be bad.

Anyway – thanks Mark for “going the distance” as an author – haven’t enjoyed a book on programming this much for a quite a while.

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • Fenrir2

    Great post! It’s a pity that this can’t be done in PHP though…

  • http://www.phppatterns.com HarryF

    Great post! It’s a pity that this can’t be done in PHP though…

    Yes it is. Well to an extent it can be done it PHP, via stuff like create_function() and that function static keyword allows you to do something a little like closures but it’s ugly and potentially dangerous – eval. Hash table dispatch does work though.

  • Fenrir2

    Yes, and you can do much of it with OOP even though that is a little more verbose :)