Start reading Working Effectively with Legacy Code on your Kindle in under a minute. Don't have a Kindle? Get your Kindle here.

Deliver to your Kindle or other device

 
 
 

Try it free

Sample the beginning of this book for free

Deliver to your Kindle or other device

Read books on your computer or other mobile devices with our FREE Kindle Reading Apps.
Working Effectively with Legacy Code
 
 

Working Effectively with Legacy Code [Kindle Edition]

Michael Feathers
4.3 out of 5 stars  See all reviews (11 customer reviews)

Print List Price: £38.99
Kindle Price: £14.94 includes VAT* & free wireless delivery via Amazon Whispernet
You Save: £24.05 (62%)
* Unlike print books, digital books are subject to VAT.

Formats

Amazon Price New from Used from
Kindle Edition £14.94  
Paperback £25.81  


Product Description

Product Description

Get more out of your legacy systems: more performance, functionality, reliability, and manageability

 

Is your code easy to change? Can you get nearly instantaneous feedback when you do change it? Do you understand it? If the answer to any of these questions is no, you have legacy code, and it is draining time and money away from your development efforts.

In this book, Michael Feathers offers start-to-finish strategies for working more effectively with large, untested legacy code bases. This book draws on material Michael created for his renowned Object Mentor seminars: techniques Michael has used in mentoring to help hundreds of developers, technical managers, and testers bring their legacy systems under control.

The topics covered include

  • Understanding the mechanics of software change: adding features, fixing bugs, improving design, optimizing performance
  • Getting legacy code into a test harness
  • Writing tests that protect you against introducing new problems
  • Techniques that can be used with any language or platform—with examples in Java, C++, C, and C#
  • Accurately identifying where code changes need to be made
  • Coping with legacy systems that aren't object-oriented
  • Handling applications that don't seem to have any structure

This book also includes a catalog of twenty-four dependency-breaking techniques that help you work with program elements in isolation and make safer changes.

From the Back Cover

Get more out of your legacy systems: more performance, functionality, reliability, and manageability

Is your code easy to change? Can you get nearly instantaneous feedback when you do change it? Do you understand it? If the answer to any of these questions is no, you have legacy code, and it is draining time and money away from your development efforts.

In this book, Michael Feathers offers start-to-finish strategies for working more effectively with large, untested legacy code bases. This book draws on material Michael created for his renowned Object Mentor seminars: techniques Michael has used in mentoring to help hundreds of developers, technical managers, and testers bring their legacy systems under control.

The topics covered include

  • Understanding the mechanics of software change: adding features, fixing bugs, improving design, optimizing performance
  • Getting legacy code into a test harness
  • Writing tests that protect you against introducing new problems
  • Techniques that can be used with any language or platform—with examples in Java, C++, C, and C#
  • Accurately identifying where code changes need to be made
  • Coping with legacy systems that aren't object-oriented
  • Handling applications that don't seem to have any structure

This book also includes a catalog of twenty-four dependency-breaking techniques that help you work with program elements in isolation and make safer changes.


© Copyright Pearson Education. All rights reserved.


Product details

  • Format: Kindle Edition
  • File Size: 2610 KB
  • Print Length: 456 pages
  • Simultaneous Device Usage: Up to 5 simultaneous devices, per publisher limits
  • Publisher: Prentice Hall; 1 edition (22 Sep 2004)
  • Sold by: Amazon Media EU S.à r.l.
  • Language: English
  • ASIN: B005OYHF0A
  • Text-to-Speech: Enabled
  • X-Ray: Not Enabled
  • Average Customer Review: 4.3 out of 5 stars  See all reviews (11 customer reviews)
  • Amazon Bestsellers Rank: #25,063 Paid in Kindle Store (See Top 100 Paid in Kindle Store)
  •  Would you like to give feedback on images?


More About the Author

Discover books, learn about writers, and more.


Customer Reviews

Most Helpful Customer Reviews
25 of 26 people found the following review helpful
4.0 out of 5 stars practical and helpful advice on testing 26 Feb 2006
By A Customer
Format:Paperback
This book focuses on how best to treat existing, large and probably poorly designed code, when needing to add features. This is most likely to happen when you have big old code that needs maintaining, but a lot of the advice is directly applicable to open source projects that lack tests and documentation. Therefore this can be considered as a valuable addition to the literature on testing and refactoring.

The advocated approach is rooted in writing unit tests and refactoring. Each chapter is themed around a problem (e.g. "Dependencies on Libraries is Killing Me", "I Don't Understand the Code Well Enough to Change It"), and then a series of techniques are suggested. At the back of the book are a series of refactorings, specifically for dealing with large classes, with some platform specific approaches, such as C++ forbidding the use of virtual functions that resolve to subclasses in constructors.

The code is mainly in Java, with a large number of examples in C++, and a handful in C and C#. You can probably get by with just knowing Java.

To get the most out of this book, I would suggest having read Martin Fowler's Refactoring first. It would also help to be familiar with the JUnit Java testing framework, which is used for the testing examples throughout. If you don't already know JUnit, you can pick up enough knowledge from the many articles on the web, and you certainly don't need to have read a book on Test Driven Development.

A reasonable measure of the quality of a book such as this is if it changes the way you code. It did so for me, and I recommend this as another high quality book in the Robert C. Martin series.

Comment | 
Was this review helpful to you?
5 of 5 people found the following review helpful
Format:Paperback
What is your view of unit tests and test-driven development (TDD)? If you believe that these techniques are merely a passing fad, or largely a waste of time, then read no further, and good luck with that approach! However, if you want to understand how TDD can be a powerful weapon for attacking the 'monsters' of ageing and not-tested code, or want to ensure that new code you write is maintainable, or indeed you (like me) are concerned about how we can effectively improve and develop legacy systems in the context of infrastructure-as-code and end-to-end automation, then Working Effectively with Legacy Code is essential reading.

The reason why we left behind the TDD skeptics (and they still exist, even as I write this in 2012) is that Michael Feathers is very clear about the nature of legacy code: legacy code has no test coverage, and 'code without tests is bad code'. Let's consider the implication of this view: even if your code was written yesterday, if there are no unit tests to characterise or define the behaviour of the code, then the code is legacy, and will be difficult to change without introducing bugs. On this basis, it becomes dangerous, disrespectful to others and perhaps even unprofessional to write code without tests.

We are also urged to expand our view of why we write tests, especially when working with legacy code: instead of specifying correctness, tests can be written to characterise behaviour of code. This is particularly helpful when we are breaking dependencies, as using tests to characterise behaviour helps to build an understanding of how non-tested code actually operates.

Michael Feathers uses the real-world image of a workbench clamp to show how tests can be used to hold tightly or 'clamp' the existing behaviour under test, just as a component in a workshop would be clamped when being worked on to avoid unexpected movement or behaviour during testing. We want to clamp the part of the code under test to enable us to work safely with it without unintended side effects.

Structure of the Book

The book has three main sections. In the first section, The Mechanics of Change, Michael asks us to consider why we want to make changes to software: is the change to fix a bug, to implement a new feature, to improve the use of resources (memory, disk, CPU), or to improve the design via refactoring? Crucially, a change set committed to version control should contain only one of these change types, not a mixture; the change set will thus have a single responsibility, and make future branching and merging easier.

The first section also introduces concepts such as 'seams' (alter behaviour without editing in that place) and 'enabling points' (the place where you choose a particular behaviour) which struck me as very effective mental constructs with which to approach any code, not just legacy code.

The second part of the book, Changing Software, consists of a set of scenarios in which you might find yourself when confronted with a codebase without tests; there are chapters such as 'My Application Has No Structure' and 'This Class is Too Big...' Use this part of Legacy Code when you have already characterised the situation you face, and want to go directly to a solution.

The third and final section, Dependency-Breaking Techniques, covers much of the same ground as part two, but from a different perspective: it is organised as a 'cookbook' of 'recipes', and the entries here together form a kind of toolbox for working with legacy code, allowing you to `dip in' to particular solutions without needing to have read the earlier sections.

Concluding Remarks

Some reviewers have noted that Legacy Code covers only those languages (C++, Java, C#, etc.) which have xUnit frameworks available, and can therefore be covered by unit tests; other 'testless', legacy code written in VB, Pascal, embedded C, COBOL, etc., is left 'out in the cold' by the book, as these languages generally cannot have unit tests retro-fitted. To my mind, this view somewhat misses the point. Feathers is clear to associate legacy code with an absence of tests, irrespective of the language.

To work effectively with legacy code, we need to bring it under test; other techniques do exist, but are likely to be unsafe and error-prone when compared to a test-driven approach.
Comment | 
Was this review helpful to you?
6 of 7 people found the following review helpful
5.0 out of 5 stars Excellent! 4 Dec 2009
Format:Paperback
I attended Feathers' speach at JAOO this year and was highly motivated to work with legacy code - I really wanted to try out all the presented techniques! I wished for the next contract to be a legacy project, and lo and behold, wishes do come true.

Given that, I was highly motivated when my copy arrived in the mail and ate it in three healthy bites - not leaving too much time to sleep when you have a wife and two small kids that you want to see too!

MF starts by stating that 'good code is code under test'.

The highligt is to some extend the 20-something page introduction. MF manages to set the arena for working with legacy code and pass on the enthusiasm of getting a job done on difficult terms. I mean, if you can be a success with green field projects, thats fine, but how well do you cope with legacy code?

Following that is a rather lengthy catalog of ways to get code under test. Much of the time you'd nod and say, yes, I've seen mess like this before - so that is how I could have dealt with it!

Having had the time to try to work by the principles, I'd summarize that the book has given me a professional lift. Many a time, I'd have to bypass the good advice due to pressure to produce short-term results, but over-all I'd say that more and more of the 'tricks' gets used and with good results.

Highly reccommended!
Anders, M.Comp.Sc., Contractor, Denmark
Comment | 
Was this review helpful to you?
Would you like to see more reviews about this item?
Were these reviews helpful?   Let us know
Most Recent Customer Reviews
3.0 out of 5 stars Good but limited
It is essentially another refactoring book. It largely assumes you will work with code written fairly recently in a modern language and to which you can apply automated unit... Read more
Published 23 months ago by D. Murphy
1.0 out of 5 stars This isn't "legacy" code!
The author claims that "legacy" code is composed of C++, Java, and C# code bases. Well...maybe if you were born only twenty years ago that might seem like legacy code. Read more
Published on 25 Feb 2011 by Michael E. Piazza
5.0 out of 5 stars Legacy Code
This was bought as a present for a friend who was very impressed with it and found it really interesting and useful.
Published on 8 Jan 2011 by Christine Davis
5.0 out of 5 stars Extremely useful!
This is definitely one of those books that I will continuously refer to when faced with the task of maintaining legacy software. It has a permanent place on my reference shelf! Read more
Published on 21 April 2010 by David JM Emmett
5.0 out of 5 stars Standard Text
I have a few (5 or so) programming books that I hold in very high regards. This is one of them. I intend to keep this one close to hand. Read more
Published on 20 Feb 2010 by O. Arnold
5.0 out of 5 stars A very useful book
The biggest single problem I had when I moved from working for myself as a programmer back to the mainstream was dealing with other people's code. Read more
Published on 20 Sep 2008 by Alan Lenton
5.0 out of 5 stars Excellent book
Got the book after attending one of the authors presentations. Excellent advice on how to apply TDD to existing code. Read more
Published on 21 May 2006 by Mr. S. P. Bracken
4.0 out of 5 stars A guide to retrofitting unit tests to existing code.
The books definiton of Legacy code is code not covered by unit tests.
This book covers adding unit tests to existing code. Read more
Published on 30 Dec 2005 by Chris Eyre
Search Customer Reviews
Only search this product's reviews

Popular Highlights

 (What's this?)
&quote;
A test is not a unit test if: 1. It talks to a database. 2. It communicates across a network. 3. It touches the file system. 4. You have to do special things to your environment (such as editing configuration files) to run it. &quote;
Highlighted by 24 Kindle users
&quote;
When you have to make a change in a legacy code base, here is an algorithm you can use. 1. Identify change points. 2. Find test points. 3. Break dependencies. 4. Write tests. 5. Make changes and refactor. &quote;
Highlighted by 23 Kindle users
&quote;
Dependency is one of the most critical problems in software development. Much legacy code work involves breaking dependencies so that change can be easier. &quote;
Highlighted by 19 Kindle users

Customer Discussions

This product's forum
Discussion Replies Latest Post
No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
Topic:
First post:
Prompts for sign-in
 

Search Customer Discussions
Search all Amazon discussions
   



Look for similar items by category


Amazon Media EU S.à r.l. Privacy Statement Amazon Media EU S.à r.l. Delivery Information Amazon Media EU S.à r.l. Returns & Exchanges