Updates
Latest Tweet
What's New?
Check out for latest innovation, a computer based training video collection
Like this Page
Perl Medic: Transforming Legacy Code Review by Ricardo Signes
great if you inherit wretched old code
When Perl Medic came out, we received a review copy. It was the first review book we got, and I was pretty excited. I took it to (of all places) the gym with me, and read it while I ran. A lot of Perl People were raving about how it was the awesomest book in a long time, and I just couldn't get that excited about it. Despite that, I find myself recommending it to more and more fellow programmers.Here are the things that I find especially useful in the book:
Tests
I am all for testing. I like testing. Testing helps me code better. Testing helps me figure out what badly documented features should do, and helps me notice that my patches are going to break in production. It's just the right thing to do. When reading, I thought the coverage of testing was a too long, but that was because I was already at home with it. Really, it's the right length for someone who's not already testing, and Peter Scott should be applauded for writing one of the first Perl books to really explain and encourage testing. Moreover, he stays true to the book's "for maintenance programmers" nature and talks about the troubles with writing tests for code you didn't write, including testing traditionally hard to test things like CGI scripts.
perldelta
The book walks through historical versions of perl from version 4 (!) to 5.8.3. The authors tells you what changed, and what you should probably do if you upgrade the platform your old Perl code is running on. (Moving to 5.6? Now you can use C. Moving to 5.8? Restricted hashes!)
Cargo Cult Perl
The author devotes almost a whole chapter to pointing out stupid things that people write because they don't really know what they're doing. open without checking the return, symbolic references, three part for, and (argh!) return undef.
I hear Dominus is working on a book on this topic. Until then, this should help people write code that will be less of a pain to maintain.
*other stuff*
Perl Medic offers a concise explanation of scoping and variable types. It's no Coping with Scoping, but it's quite clear and covers C. While a lot of Perl Medic is really for experienced folks maintaining old code, this section is something every new Perl hacker should read.
There's a nice section on figuring out WTF existing code /does/, suggesting modules to benchmark, profile, deobfuscate, and otherwise dissect the horrible code you're handed.
In the appendices, there's a few pages on "How to Ask Questions that Get Answered." There exist many of these guides, but I don't care. If every technical book spent two or three pages on this, it would be a blessing. Somebody who knows how to ask a question is going to get help, and is going to quickly be received into the community where he asks it.
*the down side*
I guess the biggest down side for me was that I just didn't learn many new things from this book. A number of things were well stated, and I recognized that this book would be useful for many people, but for the most part I didn't have many "A-ha!" moments.
There's a section on "how to use the CPAN," and I felt it was out of place. This might be, though, because I find the idea of Perl without CPAN (for non-tiny projects) to be insane. I guess there must be people who do have to deal with "anti-CPAN policies," though.
This book is definitely a good buy for anybody who's going to be taking over someone else's code, especially code that's old or just lousy. (Even if it's good code, this book can help.) Whenever I leave my job, I will make sure they pick up a copy for the new guy.