Working Effectively with Legacy Code

I’m attempting to strengthen a weakness in my knowledge, that weakness is the ability to make changes to legacy code with a high degree of confidence. Legacy code as Michael Feathers puts it in his book Working Effectively with Legacy Code, is simply code without corresponding tests. It doesn’t have anything to do with when the code was written or what language it was written in, legacy code is simply code without tests, often poorly implemented code without tests. As Feathers puts it, someone may be writing legacy code on your project right now. The amount of legacy code far out numbers the amount of new code.

In order to make timely changes to an app with confidence, unit and functional tests are necessary but the biggest problem is how to implement such tests on a system that wasn’t designed with that in mind in the first place. To introduce tests it seems you have to change code, sometimes lots of code, but if you don’t have tests already then how can you do that with any degree of confidence? I would say the current strategies I’ve learned over the years only cover about 20% of the cases, leaving about 80% to slow coding and lots of repetitious manual testing.

So far this book has changed my definition of what legacy code is and provides many solid techniques to improve existing codebases.


Hi there, I'm Seth Deckard, a software developer with years of experience working in Ruby and Rails. I co-founded WarningAware and have authored several open source projects on GitHub. You can reach me on Twitter.