Clear questions and runnable code
get the best and fastest answer
Perl Best Practicesby simonm (Vicar)
|on Jul 22, 2005 at 04:16 UTC||Need Help??|
Order Perl Best Practices
Item Description: Perl style guidelines and programming techniques from Damian Conway.
Review Synopsis: An entertaining set of suggestions that range from bracket placement to test-driven development.
It's a wonderful resource, with a web of interconnected and mutually-reinforcing heuristics that reminds me of the better parts of the design patterns literature, although the recommendations are usually at a lower-level of detail then the typical class architecture patterns.
The 256 practices are grouped into logical categories, starting with lower-level syntax and working up to object, module, and project-wide issues. Much of this is familiar ground -- for example, many of the recommendations of perlstyle show up in chapters 2 and 3 -- but for each recommendation Damian includes both the basic, well-organized information that a newcomer would need to learn, as well as a mix of entertaining examples, obscure details, and geeky jokes that will keep the attention of more experienced programmers.
For example, the recommendation to use a four-column indent is accompanied by an ACM journal citation and an amusing anecdote about the competing social pressures that favor 4 over 2 or 8. (And let's not even talk about 3-space indents -- that's totally bizarre.)
There were some stylistic recommendations that I disagreed with, but they were a small minority, and the author makes it clear from the beginning that he's not trying to lay down a system of hard-and-fast rules, but rather expects individual developers to consider these issues in their local context to reach their own conclusions.
Later chapters show sensible ways of handling more complex coding issues, with a reasonable mix of recipes to roll-your-own solution versus pointing the reader towards relevant CPAN modules. Much of the Objects chapter is based on using Damian's Class::Std, and a number of the Perl6::* modules get a plug, but the book generally refrains from just focussing on his own distributions.
Remaining chapters cover documentation, testing, and other larger development issues. The influence of agile methodologies is evident in sections on writing tests first, test automation, and synchronizing code and documentation changes.
All in all, an enjoyable read and a useful reference for my Perl bookshelf.