Book review: Perl Best Practices <i>by Damian Conway</i>

The book is published by O’Reilly, who don’t need any introduction. Conway, the book’s author and fellow Australian (but no, his nationality didn’t influence my judgement on the book!), is working on Perl 6 with Larry Wall, the man who created Perl in the first place.

The book’s cover

Conway also happens to be the author of several important Perl modules which many Perl programmers have found invaluable. I’ve personally used two of them consistently throughout my career: Text::Autoformat and Switch. So, if there is anybody in the world with the right to tell us what coding style to use, that person would be Conway.

This review could be summed up as follows: if you are a Perl programmer, and you don’t hate the rest of the (programming) world, then you need to buy this book. After reading it, you’ll never feel ashamed of sharing your source code again, and you’ll allow others to wield the real power of free software: the ability to study, understand and improve your programs.

If there is anybody in the world with the right to tell us what coding style to use, that person would be Conway, the book’s author

The contents

The book is divided into 19 chapters. Each one covers a specific aspect of coding style: code layout, naming conventions, values and expressions, variables, control structures, documentation, built-in functions, subroutines, I/O, references, regular expressions, error handling, command-line processing, objects, class hierarchies, modules, testing and debugging. As you can see, there’s a lot to read—and a lot to learn. One “plus” of this book is that the author is actually an amazingly good writer. The book is full of subtle jokes which aren’t just funny: the jokes are in fact useful tools to remember the point the section is trying to make. The writer’s style is what makes this book really special.

Who’s this book for?

The answer to this question is simple: this book is for every Perl programmer on Earth who wants to do one of the following: write programs which are more than 10 lines; allow other people to understand and improve a program’s source code; become a real, professional programmer; learn how to write good code, rather than just write code.

If every Perl programmer studied this book, the Perl world would be a very different place today.

Relevance to free software

Perl is free software; it has been defined as the “glue of the World Wide Web”. This alone is a good enough reason to consider this book very relevant to free software. However, there’s more: what this book explains is how to write self-explanatory source code. This quality is indispensable to all those programmers willing to improve existing programs. If every program were written in a cryptic manner, the real strength of free software—the ability to improve somebody else’s work and build upon it—would be in-exploitable. This is why this book is so important to free software.

Pros

This list would be too long and boring. It’s just a necessary read for anybody who writes Perl code.

Cons

The only “con” I can see in the book is in the author’s surname. The only problem I can think of, but which also exists independently from the book, is that there is objectively a lot to study. It’s not easy for a programmer to change his or her coding style, and the task may be daunting. More experienced programmers (who are more likely to write longer, more complex programs) might react negatively when they discover that the mountain of source code they produced looks like overcooked spaghetti.

Title Perl Best Practices
Author Damian Conway
Publisher O’Reilly
ISBN 0596001738
Year 2005
Pages 517
CD included No
FS Oriented 10
Over all score 10

In short

License

Verbatim copying and distribution of this entire article are permitted worldwide, without royalty, in any medium, provided this notice is preserved.