This is an effort to capture the knowledge in “Working Effectively With Legacy Code” by Michael Feathers.
What is Legacy Code?
Simply, we can refer code as legacy, if we’ve gotten them from someone else. It has broad sense in programmer-speak terms.
Legacy code is simply code without tests ~ Michael Feathers
“ Code without tests is bad code. It doesn’t matter how well written it is; it doesn’t matter how pretty or object-oriented or well-encapsulated it is. With tests, we can change the behavior or our code quickly and verifiably. Without them, we really don’t know if our code is getting better or worse.”
The code maybe clean coded and well structured, but without well written tests against the code, it’s still Legacy Code.
This series will have 25 episode as follows, divided into three parts.
PART I: The Mechanics of Change
PART II: Changing Software
- I Don’t Have Much Time and I Have to Change It.
- It Takes Forever to Make a Change.
- How Do I Add a Feature?
- I Can’t Get This Class into a Test Harness.
- I Can’t Run This Method in a Test Harness.
- I Need to Make a Change. What Methods Should I Test?
- I Need to Make Many Changes in One Area.
- I Need to Make a Change, but I Don’t Know What Tests to Write.
- Dependencies on Libraries Are Killing Me.
- My Application Is All API Calls.
- I Don’t Understand the Code Well Enough to Change It.
- My Application Has No Structure.
- My Test Code Is in the Way.
- My Project Is Not Object Oriented. How Do I Make Safe Changes?
- This Class Is Too Big and I Don’t Want It to Get Any Bigger.
- I’m Changing the Same Code All Over the Place.
- I Need to Change a Monster Method and I Can’t Write Tests for It.
- How Do I Know that I’m Not Breaking Anything?
- We Feel Overwhelmed. It Isn’t Going to Get Any Better.
PART III: Dependency-Breaking Techniques
- Dependency Breaking Techniques.
Go to the next path (Episode I).
References:
- Working Effectively With Legacy Code~ Paperback
- What is Legacy Code? Wiki
- When is code Legacy? StackExchange