Short ReviewPerl Medic: Transforming Legacy Code.
Note:
a very good book. :) :) :) :) Generally programmers vastly prefer doing new development to doing maintenance. But if new development is successful that generally leads to the need for maintenance. More or less all programmers end up doing a significant amount of maintenance. And most programmers, these days, end up doing way more maintenance than new development. But training is typically skewed toward new development. This book focuses on maintenance, and, more specifically, it focuses on maintaining Perl programs. It provides valuable perspective and details for doing that too. Even if your primary interest is new development, this book could be of great value. If your new development is successful, it will need to be maintained. If your new Perl development takes into account the insights of this book, maintenance will likely be much easier. George Woolley of Oakland.pm [top] OtherChapter Titles
Note:
[top] Safari WatchAs of 2004-04-06, this book was not on Safari Books Online :( though many other Addison Wesley books are accessible there. [Annotation: But it was added shortly after that. :) (#A) ] |
Somewhat Longer ReviewContents
[top] Who's This Review For?If you're a beginner at Perl, I suggest reading the short review in the left column. I don't recommend your reading all of this more detailed review. I do, however, suggest reading the section "Who's the Book for" and the subsection "beginners" under "Gripes". If you are looking for an evaluation of the author's detailed knowledge of the subject, you should look for a different review. I don't pretend to be knowledgeable enough to give such an evaluation. If you've been around Perl for a while and don't consider yourself an expert and wish to get a sense whether this book might be useful to you, this review may be quite helpful. [top] The TitleWhy the medical metaphor in the title? The author says that as maintenance programmers we often have to perform triage, and we often have to apply the equivalent of bandaids to programs that are in drastic shape. Maintenance programming is fraught with difficulties and most programmers would prefer to do new development. In teaching how to program Perl well, the author found students didn't want to take a significant amount of time away from how to write good programs to focus on how to maintain. As I understand it, this book is meant to provide a guide to how to maintain Perl programs well. [top] About the ReviewerI started programming in Perl in 1994. I've had the opportunity to do quite a bit of maintenance and quite a bit of new development in a variety of programming languages. However, Perl is easily my favorite language. IMO, the following are often inadequately addressed
Here's a couple of limitations in my background that seem particularly relevant here
Partly as a consequence of my limitations as a reviewer, I'll focus my attention on such things as how the book was valuable to me, whether it's clearly written, ... [top] Extreme TestingThe third chapter of this book is on Extreme testing. This chapter is intentionally placed early. What an excellent idea! :) The author argues persuasively for Extreme Testing. One of the principles of Extreme Testing is that tests should be developed prior to (rather than after) code. The author also provides enough perspective and detail for a Perl programmer to begin to do Extreme Testing. [top] Grok MaintenanceThe author provides convincing arguments for learning to maintain well in Perl assuming we are Perl programmers and then proceeds to provide a good deal of valuable perspective, tips, etc. on how to do that. :) See the section below entitled "My Case Study" for some of the things in the book that helped me recently when doing some maintenance on an archaic program (written by myself many years ago). [top] My Case StudyIn this section I'll recount some of my experience using this book as a guide for doing some modest cleaning up of a program I wrote years ago. The idea was to use this as one very concrete test of the book's usefulness. the program to clean up: I used the book as a guide when I did some cleanup of a CGI I originally wrote in Perl 4 somewhere in the period 1995-1997. Sometime in 1998, most of the program was made to run under Perl 5 and to use strict, and some other improvements were made. The CGI has not been a source of problems. However, I've generally shied away from making any changes to it because I no longer had a good sense for it's structure. Also, it still used the old Perl 4 CGI library (cgi-lib). Yuk. I decided to move it a step closer to a program that would be easily maintained. The two main things I ended up doing were
I also made numerous small changes to the cgi and the closely related templates. chapter by chapter: The chapters that helped me the most in this effort were the first six. For each of these six chapters I'll note one or two of the insights, tips, etc. that I found useful in doing this modest cleanup. chapter one: This chapter has to do with what to do in the period shortly after you discover you'll be taking over a program. There's some good advice here. Two pieces of advice that I appreciated being reminded of and followed were:
There were, indeed, files other than program files involved. And I did capture and stash for safe keeping the original files. chapter two: This chapter is entitled "Surveying the Scene". In it, we become a bit more aware of what we've got. Two pieces of advice I acted on were:
I actually remembered that the code was originally written in Perl 4. By looking at the comments in the code I was able to determine that by 1998 the CGI was running under Perl 5. The programs involved were a CGI and 4 libraries. Using a technique described by Scott it was quite simple to determine the dependencies between them. chapter three: This chapter is on Extreme Testing and was probably the most valuable chapter of all for me. Two pieces of advice I acted on were:
Well, I didn't figure out any way to replace the Perl 4 cgi-lib gradually, and it took a while to get the CGI running at all after my surgery. However, once I had it running at all, having the test cases made getting it running properly really easy. I look forward to having the time to continue moving the CGI forward. I expect having the test cases available and adding test cases for any new requirements to make that a piece of cake. chapter four: This chapter contains much useful advice for rewriting a Perl program. Some of the advice is stylistic. Mostly, I didn't implement the advice in this chapter, though I sure did mark a lot of tips for the next round. One thought that I did find quite helpful was:
chapter five: Silly me. My practice has been to just turn on all warnings. Because of reading this chapter and doing some follow up research, I now feel quite comfortable turning off particular warnings selectively. This is not very difficult, but I probably wouldn't have gotten around to learning how had I not read this chapter. With the archaic code I was running, this turned out to be quite useful in moving it forward. chapter six: The insight that was most useful from this chapter was to use CGI.pm. The program was using the old Perl 4 CGI library which I was happy to dispense with. final remarks re my case study: The book was quite useful in supporting my efforts to do a modest cleanup of this CGI. I believe future upgrades of the CGI will benefit from
[top] Who's the Book for?The preface says the book is for anyone taking over Perl code written by someone else or even by themselves at an earlier time. On the cover of my copy of the book is the quote "If you code in Perl, you need to read this book." Works for me. Even if you expect somehow to avoid maintaining programs, someone else will likely need to maintain them. You can likely write a more professional, more maintainable program by reading this book and applying its insights. The preface also says that parts of the book are suitable for early beginners and that parts are for more experience programmers. So, how early a beginner is the book appropriate for? Well, personally I wouldn't recommend this book for a raw beginner. However, I can see it being of considerable value to someone who had written a couple of small Perl programs that actually do something useful. [top] GripesThere are a number of things that bother me about this book. I'll touch on three of them here. However IMO none of them are deal breakers. beginners: I understand the author intends this book to be useful for beginners. Well, the author does seem to have a gift for being clear and a gift for being able to provide both perspective and nitty gritty details. And there's lots of valuable info here suitable for a beginner. However, I'd feel more comfortable recommending this book for a beginner if the author included
On the other hand, I thought the advice on how to ask questions that get answered was excellent. It's a valuable reminder for most of us, but especially relevant for beginners. for further reference: In the preface there is a section entitled "For Further Reference". I was puzzled to see "Effective Perl Programming" recommended as an introduction to Perl programming. IMO it's an excellent book but not an introduction to Perl programming. The same section contains a link to the book's website which I expected to have further references and which I hoped would give some hint as to the origin of what to me seemed a mischaracterization of "Effective Perl Programming". Alas, what I found instead was a site that focused on selling Scott's books and related programming services. Oh, well. musts: The book ends in three musts. Personally I think this is a really bad idea. Telling someone they must have fun, in particular, seems to me both pointless and annoying. keeping things in perspective: Many readers will consider my gripes subjective or just not care about them. In any case, I found them to be relatively minor annoyances. [top] Final ThoughtsFrom my somewhat limited perspective, this is a very good book that most Perl programmer's would benefit from reading. It provides a wealth of valuable info on how to do a good job maintaining Perl programs. I used this book as a guide when I recently did some cleanup on a Perl CGI originally written many years ago. It served me well for that. [top] |
Last Updated: 2003-04-08 [Annotation: really 2004-04-08 (#A)]
Annotation #A: 2004-08-09