Related products:
Higher-Order Perl: Transforming Programs with Programs
Perl Testing : A Developer's Notebook
Advanced Perl Programming
Perl Cookbook, Second Edition
Learning Perl Objects, References, and Modules
|
Perl Books
Perl Best Practices
Format: Paperback
Author: Damian Conway
ReleaseDate: 12 July, 2005
Publisher: O'Reilly Media
Rating:
Good Coding Methods to Improve Your Perl
I also have to admit to being torn about the author -- after all, he is one of those poor fools who insist on living in cold, unenlightened Melbourne, while I live in vastly superior Sydney. I have to admit that I can bristle at books that try to preach, so Perl Best Practices was on a hiding to nothing when I came to review it. On the other hand, how can I dislike a man who manages to place a quote that involves my favourite character, Lady Bracknell. from my favourite comic play, 'The Importance of Being Earnest,' in the first few pages of his book?
Many years ago I read a marvelous article that explained why so may early editors and word processors supported the keyboard commands of WordStar. When it's first born, a baby duck can be easily convinced that almost anything is its mother. The small bird imprints, and it takes a lot to shift its focus. "Baby Duck Syndrome" affects programmers in a number of ways, not just their choice of editor, and Conway is walking right into the middle and arguing with your imprinting on almost every page. A brave man; fortunately he has the street cred to make you at least listen.
So I carefully placed my bias and bigotry in the bottom drawer and prepared myself. I discovered a well-written, informed and engaging book that covers a number of methods (hey, 256 rules, come on Derrick, 2 ^ 8 rules can't be a coincidence!) for improving your Perl software when working in a team. That means all of us when you remember an adage a guru once told me: "Every piece of computer software, no matter how small, involves at least a team of two -- me, and me six months from now when I have to fix it. " Conway puts it differently "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. "
The first chapter outlines the why and where of the book. The why is to improve your code with three goals; robustness, efficiency and maintainability. The chapter finishes with a short exhortation to us to "rehabit. " Don't like the word much but I applaud the aim.
Conway is far from timid. He jumps right in to the deep end of the wars, with formatting the appearance of your code. I thought the chapter was brilliantly written until he told me I shouldn't "cuddle else statements," at which point I realized what an ill-informed idiot he was. Oh, hang on. Hey, that almost makes sense. OK, that's a cogent argument for your point of view, Conway. I also have to admit that earlier you did say that your rules for this bit weren't gospel, that if you wanted a variation that was OK, just have a standard and make sure you can support it with a code prettier. Perhaps not a total idiot after all.
After successfully negotiating those shark infested waters, Conway -- obviously a man who knows no fear -- wades into naming conventions. Once again he gives coherent arguments, pointed examples and counterexamples. It all makes sense.
The book's page at O'Reilly has an example chapter and a good description, but no table of contents so here's a quick list of the headings:
1. Best Practices
2. Code Layout
3. Naming Conventions
4. Values and Expressions
5. Variables
6. Control Structures
7. Documentation
8. Built-in Functions
9. Subroutines
10. I/O
11. References
12. Regular Expressions
13. Error Handling
14. Command-Line Processing
15. Objects
16. Class Hierarchies
17. Modules
18. Testing and Debugging
19. Miscellanea
Suffice to say that Conway leaves no corner of Perl uncovered, offering well-reasoned and well-explained advice on improving your Perl code.
The book is also well-written and well-edited. The order of topics covered is a sensible one, and the book is appropriately structured. It reads and feels as if you are being given the wisdom from many a hard-won battle coding and maintaining Perl code.
My one complaint is that I found it dry: you are reading through pages of argument and examples without much relief. Perhaps this book might be best digested in a number of chunks, making the effort to use the ideas from each chunk for a while before moving on to the next.
Every so often I read a book from O'Reilly that makes me fear that they are slipping, then along comes a book like Perl Best Practices, and I'm reminded that when it comes to Perl, O'Reilly authors wrote the book. Once you've rushed through Larry's book and learnt the finer points with Schwartz and Phoenix's 'Learning' titles, you may well find that this is the perfect volume to complete your Perl education. If you believe your Perl education is complete, then buy this volume and I'm sure you'll find a lesson or two for yourself.
This book is not really aimed at the occasional Perl programmer (though many of us would probably benefit from its wisdom), but at the person who is professionally programming in Perl and wants to produce better quality, more easily maintained code. For this person Perl Best Practices is a 5. For the rest of us, the 'rehabiting' process might be a little too arduous; personally, I'm going to pick a few of the chapters and work on those for a while, maybe naming conventions and variables. For me I'll give it 4 stars.
Not perfect but still quite good...
8. "Perl Best Practices" provides a good tour of the current features of
Perl 5.x and sheds light on all the corners of the language except
one. I didn't understand why there is no info on Win32 Perl (use
"chomp" instead of "chop", stuff like that). The book would have been
better if it hadn't shied away from that. It seems like Conway
decided to leave OS-specific best practices for another book. Apart
from that one gripe the book is quite good and will force the reader
to think about ways to improve his programming even though no one will
agree with everything. The books strongest point is that it touches
on the oldest parts of the language and also some really new stuff
like importing Perl 6 behavior via CPAN modules, and ties it all
together into a coherent body of thought. The thing that really
shines is how much Conway understands how Perl works as a programming
language and is honest about where it's lacking. Apart from the
absence of any Win32 or other OS-specific content, this book is a
treasure and worth owning and referring to often.
I learned a lot from this book.
The author clearly pushes some peoples buttons. I think it is very telling that all the reviews so far are 5 star or 1 star. You don't have to agree with every recommendation made, but a lot can be learned from the discussion of each topic. It's rare for me to read a technical book cover-to-cover, but I did with this book and enjoyed it. I've started reading some sections again.
|
|