I got my wisdom teeth taken out on Wednesday and decided to read my new copy of "Working Effectively with Legacy Code" by Michael Feathers. To sum it all up.... I would rather have my wisdom teeth removed than recommend this book to anyone who has any experience with legacy code.

51RCXGPXQ8L._AA240_

I found that the book was a wrapper for Martin Fowlers Refactoring with a lot of buzz words like TDD, SRP, OCP, and more scattered liberally throughout the book without much about applying these ideas to legacy code. I think that if you have read Refactoring that you should have lots of skills for dealing with legacy code.

The book seemed very focused on breaking apart dependencies and testing. Granted, tight coupling makes it hard to effectively unit test an application and testing is very important. Other than that the book did not really talk about things I was expecting like some legacy code smells and how to effectively deal with them. Also one huge thing for testing is mocking that was barely mentioned in the book.

Part II of the book is broken into questions that I will summarize with my answers to these questions:

1. I Don't Have Much Time and I Have to Change it

You probably have no time because you keep rushing through things and creating bugs. If there is not enough time then tell your boss that you need more time to get it done right!

2. It Takes Forever to Make a Change

You are probably a crappy programmer and should consider a career change.

3. How Do I Add a Feature?

Seriously? This is a problem people run into? How do I add a feature? WRITE SOME CODE!

5. I Can't Run This Method in a Test Harness

You should probably learn how to write tests! (Ok I am giving this one a hard time as with dependencies being involved this might not be so easy)

6. I Need to Make a Change. What Methods Should I Test?

You should test everything that could be effected by the change. This is not rocket science.

8. I Need to Make a Change, but I Don't Know What Tests to Write

Then you probably should ask an adult for help

9. Dependencies on Libraries Are Killing Me

Stop being such an emo kid and man up.

10, My Application Is All API Calls

You should probably add some logic to it then

11. I Don't Understand the Code Well Enough to Change It

Then you should not be changing it. Find someone who does or write tests around that method until you understand it.

 

I find that this book fits in that gray area of uselessness. It touches on some good ideas and techniques but really does not get into them enough to be useful. It also does not talk about how to work effectively with legacy code in my mind. It tells you how to get legacy code under test (and I did not think it even did a good job on that).