Perl Medic: Transforming Legacy Code and over 2 million other books are available for Amazon Kindle . Learn more
£22.12
  • RRP: £25.99
  • You Save: £3.87 (15%)
FREE Delivery in the UK.
Only 1 left in stock.
Dispatched from and sold by Amazon.
Gift-wrap available.
Perl Medic: Transforming ... has been added to your Basket
Trade in your item
Get a £0.25
Gift Card.
Have one to sell?
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See this image

Perl Medic: Transforming Legacy Code: Maintaining Inherited Code Paperback – 5 Mar 2004


See all 3 formats and editions Hide other formats and editions
Amazon Price New from Used from
Kindle Edition
"Please retry"
Paperback
"Please retry"
£22.12
£16.60 £1.90



Trade In this Item for up to £0.25
Trade in Perl Medic: Transforming Legacy Code: Maintaining Inherited Code for an Amazon Gift Card of up to £0.25, which you can then spend on millions of items across the site. Trade-in values may vary (terms apply). Learn more

Product details

  • Paperback: 336 pages
  • Publisher: Addison Wesley; 1 edition (5 Mar 2004)
  • Language: English
  • ISBN-10: 0201795264
  • ISBN-13: 978-0201795264
  • Product Dimensions: 17.7 x 2 x 23.4 cm
  • Average Customer Review: 4.5 out of 5 stars  See all reviews (2 customer reviews)
  • Amazon Bestsellers Rank: 1,587,749 in Books (See Top 100 in Books)
  • See Complete Table of Contents

More About the Author

Discover books, learn about writers, and more.

Product Description

From the Back Cover

  • Cure whatever ails your Perl code!
  • Maintain, optimize, and scale any Perl software... whether you wrote it or not
  • Perl software engineering best practices for enterprise environments
  • Includes case studies and code in a fun-to-read format

If you code in Perl, you need to read this book.—Adam Turoff, Technical Editor, The Perl Review.

Perl Medic is more than a book. It is a well-crafted strategy for approaching, updating, and furthering the cause of inherited Perl programs.—Allen Wyke, co-author of several computer books including JavaScript Unleashed and Pure JavaScript.

Scott's explanations of complex material are smooth and deceptively simple. He knows his subject matter and his craft-he makes it look easy. Scott remains relentless practical-even the 'Analysis' chapter is filled with code and tests to run.—Dan Livingston, author of several computer books including Advanced Flash 5: Actionscript in Action

Bring new power, performance, and scalability to your existing Perl code!

Today's Perl developers spend 60-80% of their time working with existing Perl code. Now, there's a start-to-finish guide to understanding that code, maintaining it, updating it, and refactoring it for maximum performance and reliability. Peter J. Scott, lead author of Perl Debugged, has written the first systematic guide to Perl software engineering. Through extensive examples, he shows how to bring powerful discipline, consistency, and structure to any Perl program-new or old. You'll discover how to:

  • Scale existing Perl code to serve larger network, Web, enterprise, or e-commerce applications
  • Rewrite, restructure, and upgrade any Perl program for improved performance
  • Bring standards and best practices to your entire library of Perl software
  • Organize Perl code into modules and components that are easier to reuse
  • Upgrade code written for earlier versions of Perl
  • Write and execute better tests for your software...or anyone else's
  • Use Perl in team-based, methodology-driven environments
  • Document your Perl code more effectively and efficiently

If you've ever inherited Perl code that's hard to maintain, if you write Perl code others will read, if you want to write code that'll be easier for you to maintain, the book that comes to your rescue is Perl Medic.

On the Web Site

Download all of the book's sample code from <www.perlmedic.com>.

About the Author

PETER J. SCOTT runs Pacific Systems Design Technologies, providing Perl training, application development, and enterprise systems analysis. He was a speaker on the 2002 Perl Whirl cruise and at YAPC::Canada, and he founded his local Perl Monger group. A software developer since 1981 and a Perl developer since 1992, he has also created programs for NASA's Jet Propulsion Laboratory. Scott graduated from Cambridge University, England, with a Master's of Arts Degree in Computer Science and now lives in the Pacific Northwest with his wife Grace, a cat, and a parrot, at least one of which also uses Perl. He is the lead author of Perl Debugged.


Inside This Book (Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index
Search inside this book:

Customer Reviews

4.5 out of 5 stars
5 star
1
4 star
1
3 star
0
2 star
0
1 star
0
See both customer reviews
Share your thoughts with other customers

Most Helpful Customer Reviews

4 of 4 people found the following review helpful By David Cross on 24 April 2004
Format: Paperback
A quote on the front cover of this book says "if you code in Perl then youneed to read this book". That's a pretty bold claim to make. It made methink of the hyperbole on covers of books that claim to teach you toprogram in Perl in just a few days. But this book is published by AddisonWesley, who are a well respected technical publisher of technical booksand the quote is from Adam Turoff who certainly knows what he's talkingabout when it comes to Perl programming. So in this case the claim isn'thyperbole. The book really is one that I want every Perl programmer toread.
Perl gets a lot of bad press from people who claim that it encouragespeople to write unreadable code. Whilst there's certainly a lot of verybad Perl code out there I think that's more a sign that it's used by a lotof people who don't know how to program than a reflection on the languageitself. And that's where this book comes in. It assumes that you arefamiliar with the syntax of Perl but that you've never really been shownhow to use it effectively. Which is a situation that many Perl programmersfind themselves in.
Perl Medic is actually targetted at people who have to maintain older Perlcode written by someone else, but I think that the information it containsis just as useful to anyone coding in Perl. Peter Scott has a lot ofexperience in writing Perl and in training other people to write Perl andthe distillation of that experience and knowledge into these 300-odd pagesmean that there are few Perl programmers who won't pick up somethinguseful from this book.
The main emphasis in the book is on increasing the maintainability ofcode. The techniques are wide-ranging. I particularly enjoyed the examplesof refactoring programs and the coverage of using modules from CPAN.
Read more ›
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
Format: Paperback
Like author Peter Scott's previous book (co-written with Ed Wright), Perl Debugged, Perl Medic is rather inaccurately titled. Both books are collections of advice and tips on best practices and idioms in Perl, like Effective Perl Programming and Perl Best Practices. You can think of Perl Medic as a sequel to Perl Debugged. You definitely don't need to have read the former, but if you have, you should have a good idea about the format and contents you can expect here.

There is more advice on code style, low-level stuff like brace indentation and choosing decent variable names. Additionally, tracing, profiling, benchmarking and logging are again introduced. Some of this is admittedly rather reminiscent of what appeared in Perl Debugged. Happily, also present is the clear writing, which is informal without ever talking down to the reader.

Perl Medic, however, has a more agile flavour than Perl Debugged. Again, there is a chapter on unit testing, but it's much more fleshed out in this book, featuring far more modules, and providing an entire Test Driven Development example of a bounds-checked array.

Also, some refactorings are introduced, such as inlining temporary variables and extracting subroutines. The final chapter of the book is a refactoring example on some ancient Perl 4 cgi code, that pulls together most of the themes of the book.

There's also an in-depth discussion of what the strict and warnings pragmas entail, beyond that provided by most books. Also worthy of note is the chapter on 'cargo cult' Perl, where the author's pet peeves about non-idiomatic Perl code are explored, from practices which are merely pointless to the downright wrong.

Much of this material is general good practice.
Read more ›
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again

Most Helpful Customer Reviews on Amazon.com (beta)

Amazon.com: 7 reviews
16 of 17 people found the following review helpful
Novel and effective tutorial in solid Perl Programming 18 Mar 2004
By Jack D. Herrington - Published on Amazon.com
Format: Paperback
You can learn a lot from books (or so it seems), but you can't learn a feel for the language. I had read all of the O'Reily Perl books and found myself in charge of a large Perl project writing new code. I hired on a real Perl guru and he taught me a ton, in person, about how to write Perl as Perl and do it well. What amazes me about Perl Medic is how much of what the Perl guru taught me is in this book. It's as if I had the man by my side again.
On it's face that makes it sound like you should pick up the book immediately. And for someone who is serious about Perl I think you should get this book. But there are still some faults. It could be a little better organized. And some of the common problems, like CGI scripts having embedded HTML, could be given more prominence and the text templating alternative given some more space. I looked in the tiny index for HTML::Template and found only two references, both of which were pretty short.
In what is probably both a curse and a blessing the book is not only about fixing legacy code. The majority of the book is about becoming a better Perl programmer and writing Perl as Perl. There are a few chapters and the beginning and end that are specifically about working with legacy code, but the majority of the book is practical insights into Perl coding styles using code fragments with effective exposition.
Small problems aside. This unique book is fun to read and is packed with valuable insights if you spend the time to look. The author obviously knows a lot about Perl and understands how to convey that knowledge to the reader effectively. If you are looking to maintain some Perl, or if you have hit a plateau in your understanding of Perl and you need a push to get to a higher level this book is for you.
11 of 11 people found the following review helpful
One of the best Perl books out there 24 Jun 2004
By David Cross - Published on Amazon.com
Format: Paperback
A quote on the front cover of this book says "if you code in Perl then you need to read this book". That's a pretty bold claim to make. It made me think of the hyperbole on covers of books that claim to teach you to program in Perl in just a few days. But this book is published by Addison Wesley, who are a well respected technical publisher of technical books and the quote is from Adam Turoff who certainly knows what he's talking about when it comes to Perl programming. So in this case the claim isn't hyperbole. The book really is one that I want every Perl programmer to read.
Perl gets a lot of bad press from people who claim that it encourages people to write unreadable code. Whilst there's certainly a lot of very bad Perl code out there I think that's more a sign that it's used by a lot of people who don't know how to program than a reflection on the language itself. And that's where this book comes in. It assumes that you are familiar with the syntax of Perl but that you've never really been shown how to use it effectively. Which is a situation that many Perl programmers find themselves in.
Perl Medic is actually targetted at people who have to maintain older Perl code written by someone else, but I think that the information it contains is just as useful to anyone coding in Perl. Peter Scott has a lot of experience in writing Perl and in training other people to write Perl and the distillation of that experience and knowledge into these 300-odd pages mean that there are few Perl programmers who won't pick up something useful from this book.
The main emphasis in the book is on increasing the maintainability of code. The techniques are wide-ranging. I particularly enjoyed the examples of refactoring programs and the coverage of using modules from CPAN. Two other very good sections are the one on antipatterns in chapter 4 and the one on cargo cult programming in chapter 6. Together these sections give a programmer a number of easy to recognise quick wins when improving existing code and a checklist of things not to do when writing new code.
There are a couple of niggles. I've already mentioned that I think the book has been slightly mis-targetted and that it should have been aimed at anyone writing Perl code. The other problem that I had was that the medic analogy that runs through the book gets a bit strained at times. But these are only minor and they shouldn't prevent you from adding this book to your library.
In fact, all in all, the quote on the front cover is pretty accurate.
8 of 8 people found the following review helpful
A good book with a misleading title 18 May 2004
By Kenneth Graves - Published on Amazon.com
Format: Paperback
While the "medic" metaphor recurs throughout the book, most of the material isn't directly related to repairing old code. Instead, this is a collection of best practices for new code. (The author recommends rewriting existing code if at all possible.) It ends up resembling another excellent Perl title, Joseph Hall's Effective Perl Programming. Good company to keep. Perl Medic has the advantage of being newer, and of covering a bit more material. The writing style is very easy to read, and the order of presentation works well. An excellent title for any intermediate-level Perl programmer.
great if you inherit wretched old code 5 Aug 2007
By Ricardo Signes - Published on Amazon.com
Format: Paperback
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<our>. 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<our>. 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.
Bad title, good contents 17 July 2007
By Thing with a hook - Published on Amazon.com
Format: Paperback
Like author Peter Scott's previous book (co-written with Ed Wright), Perl Debugged, Perl Medic is rather inaccurately titled. Both books are collections of advice and tips on best practices and idioms in Perl, like Effective Perl Programming and Perl Best Practices. You can think of Perl Medic as a sequel to Perl Debugged. You definitely don't need to have read the former, but if you have, you should have a good idea about the format and contents you can expect here.

There is more advice on code style, low-level stuff like brace indentation and choosing decent variable names. Additionally, tracing, profiling, benchmarking and logging are again introduced. Some of this is admittedly rather reminiscent of what appeared in Perl Debugged. Happily, also present is the clear writing, which is informal without ever talking down to the reader.

Perl Medic, however, has a more agile flavour than Perl Debugged. Again, there is a chapter on unit testing, but it's much more fleshed out in this book, featuring far more modules, and providing an entire Test Driven Development example of a bounds-checked array.

Also, some refactorings are introduced, such as inlining temporary variables and extracting subroutines. The final chapter of the book is a refactoring example on some ancient Perl 4 cgi code, that pulls together most of the themes of the book.

There's also an in-depth discussion of what the strict and warnings pragmas entail, beyond that provided by most books. Also worthy of note is the chapter on 'cargo cult' Perl, where the author's pet peeves about non-idiomatic Perl code are explored, from practices which are merely pointless to the downright wrong.

Much of this material is general good practice. However, there are some chapters that help to justify the 'legacy code' approach. Chapter 7 provides a potted history of the different versions of Perl from Perl 4 onwards, and how to spot which version a program was targetted at. There is some mention of legacy code in the unit testing chapter, but not much.

In general, I think a lot of the suggestions will be obvious to anyone with experience with Perl, or experience with another modern programming language: use new modules from CPAN where you can, use lexically scoped (my) variables and localise global access and, of course, turn on strict and warnings. Overall, I wasn't much convinced with the 'legacy code' aspect of the book and the strained medical metaphor renders many of the chapter names nonsensical.

Another slight problem I had is that, like Perl Debugged, there can be a lack of flow between (and sometimes within) chapters. Chapter 10, nominally about maintainability, starts with assertions and Eiffel-style contract programming, and then goes onto logging, tieing, overloading, POD and version control integration. It's hard to see this as a cohesive whole.

If you're looking for a book on dealing with legacy code, Michael Feathers' Working Effectively with Legacy Code provides more bang for your buck -- although it's not Perl-specific (in fact, I'm pretty sure there's no Perl code in it at all). However, if you're a budding agilist looking for Perl-based examples of refactoring and TDD, then this is a good choice. Less experienced Perl programmers should definitely consider this, especially alongside Perl Debugged, as it provides both a good grounding in best practices, and more advanced development skills such as profiling and code coverage.
Were these reviews helpful? Let us know


Feedback