Skip to content
Scan a barcode
Scan

Perl Best Practices: Standards and Styles for Developing Maintainable Code

Select Format

Select Condition ThriftBooks Help Icon

Recommended

Format: Paperback

Condition: Good

$5.19
Save $34.80!
List Price $39.99
Almost Gone, Only 2 Left!

Book Overview

Many programmers code by instinct, relying on convenient habits or a "style" they picked up early on. They aren't conscious of all the choices they make, like how they format their source, the names... This description may be from another edition of this product.

Customer Reviews

5 ratings

This book has changed my life

This is a must-read for any Perl programmer. You are only as good as the teachers you have, and if your teachers use stuff like $|++, you are screwed. In this case, Conway would tell you to Use English;, and then you'd know what a $| is. A sampling of other tips: Don't modify via $_ (too easy to screw things up) Use hashes for arguments if arguments > 3 (trackability) <br />Use Croak instead of die (Croak gives more info, better for debugging) <br />Use ' ' instead of " " when no interpolation (less ambiguity) <br />Don't use unless (complication and confusion). <br />use /xms in regexes (for readability, and avoiding mistakes) <br />test when closing or opening a file <br /> <br /> <br /> <br />A few of the reviews here are 1 star. IMO these are people to which "freedom" is more important than "group code maintainability". This should really be the third Perl book for anybody, after Learning Perl and Intermediate Perl. <br /> <br /> <br />For those wanting to test their code against this book, there is a Perl Module, Perl::Critic, that does the job.

If only there were more books as good as this

This book is probably one of the best tech books I've read. The topics he covers range quite a bit starting from the very beginning with programming style through documentation and error handline. Style is a contentious topic, if ever there was one, but he argues convincingly for each of the points he makes and gives practical reasons why it benefits you to code in a certain way. We've all heard many of these things before, but I've never been convinced that the particular way I coded was less good than any other proposed way - this book has changed my opinion on that. He brings up so many topics, some well discussed and some more esoteric and presents practical benefits that almost anyone who reads it, I expect, will come away with some new habits. I think there are very few books I've ever read that could convince people to change their programming ways - years of developing versus a couple hours of reading. You may not agree with every point he makes, but he'll make you think about why you do certain things, and that can't but help make you a better programmer. I can not recommend this book enough to any perl developer out there. If you're new to it or been doing it for years, this book is for you.

THE BEST OF PERL

It's almost a certainty that you won't like all of the suggestions that follow if you're an experienced developer. Author Damian Conway has done an outstanding job of designing a book to help you write better Perl code. Conway begins by explaining why it might be worth reassessing your current coding practices. Next, the author tackles the many contentious issues of code layout. Then, he presents a series of guidelines that can help you choose more descriptive name for variables, subroutines, and namespaces. Conway continues by providing a simple set of rules that can help you avoid common pitfalls when creating character strings, numbers, and lists. In addition, the author next explores a robust approach to using variables. He also examines Perl's rich variety of control structures, encouraging the use of those that are easier to maintain, less error-prone, or more efficient. The author next suggests a series of techniques that can make documenting your code less tedious, and therefore more likely. Next, the author discusses better ways of using some of Perl's most popular built-in functions, including sort, reveres, scalar, eval, unpack, split, substr, values, select, sleep, map and grep. Conway continues by describing efficient and maintainable ways to write subroutines in Perl, including the use of positional, named, and optional arguments; argument validation and defaults; safe calling and return conventions; predictable return values in various contexts; and, why subroutine prototypes and implicit returns should be avoided. Next, he explains how to open and close files reliably; when to use line-based input, how to correctly detect interactive applications; the importance of prompting ; and, how best to provide feedback to users during long non-interactive tasks. Then, he offers advice on demystifying Perl's many dereferencing syn-taxes; discusses why symbolic references create more problems than they solve; and, recommends ways to prevent cyclic reference chains from causing memory leaks. The author next presents guidelines for using regular expressions. Then, he advocates a coherent exception-based approach to error handling, and explains why exceptions are preferable to special return values or flags. Next, he addresses the design and implementation of command-line interfaces, both for individual programs and for application suites. Conway continues by offering a robust and efficient approach to creating objects and class hierarchies in Perl. Next, he looks at non-object-oriented modules; exploring the best ways to create them; design their interfaces; declare and check their version numbers; and, refacter existing code into them. Then, he encourages the use of testing, advocating test-driven design and development using the core Test:: modules. Finally, he offers several additional guidelines on miscellaneous topics such as revision control; interfacing to code written in other languages; processing configuration files; text formatting

Gutsy, well researched and written

I love this book, and I'm impressed with the guts it took to write it. Perl is a "there are many ways to do it" language, and Perl programmers are adamant about finding clever solutions in the language. This book sets down a set of guidelines for the most professional way to do it. And in so doing pays Perl a lot more respect than it's paid in other books. I strongly recommend that anyone writing Perl professionally should read this. But I do have an issue or two with it. For example, I think it was wrong to start off with a rule about brackets. That's one thing that people are religious about and there is no real reason to go one way or another. That starts the book on a weak premise. From which it quickly recovers. Overall, a fantastic book. Well written and researched. It's the kind of book I would expect from Damian Conway and I wasn't let down. A must-read for Perl programmers.

If you program in Perl, you need this book

What a great book. If you have experience programming in Perl you will truely appreciate the hard won insights of the author. As I read through the author's tips and guidelines for Perl programming I would constantly find myself thinking 'what a great idea' or 'why didn't I think of that'. We are always told in programming 'don't reinvent the wheel', as advice to find code already written to solve our problem. Well, with this book you can do something just as good regarding the learning process of Perl programming. Following the author's guidelines will save you countless hours by making you a better Perl programmer. I wish I had this book about 5 years ago, it would have improved my Perl programming ten fold. Better late than never.
Copyright © 2024 Thriftbooks.com Terms of Use | Privacy Policy | Do Not Sell/Share My Personal Information | Cookie Policy | Cookie Preferences | Accessibility Statement
ThriftBooks® and the ThriftBooks® logo are registered trademarks of Thrift Books Global, LLC
GoDaddy Verified and Secured