Skip to Content
Working Effectively with Legacy Code
book

Working Effectively with Legacy Code

by Michael Feathers
September 2004
Intermediate to advanced
464 pages
10h
English
Pearson
Content preview from Working Effectively with Legacy Code

Chapter 11: I Need to Make a Change. What Methods Should I Test?

We need to make some changes, and we need to write characterization tests (186) to pin down the behavior that is already there. Where should we write them? The simplest answer is to write tests for each method that we change. But is that enough? It can be if the code is simple and easy to understand, but in legacy code, often all bets are off. A change in one place can affect behavior someplace else; unless we have a test in place, we might never know about it.

When I need to make changes in particularly tangled legacy code, I often spend time trying to figure out where I should write my tests. This involves thinking about the change I am going to make, seeing what it will affect, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Clean Code: A Handbook of Agile Software Craftsmanship

Clean Code: A Handbook of Agile Software Craftsmanship

Robert C. Martin

Publisher Resources

ISBN: 0131177052Publisher Support