Refactoring: Improving the Design of Existing Code

Book review by Deane Barker tags: programming

This is one of the great books of computer science.

As the title would imply, it’s about fixing the internals of computer programs, without changing how the program functions from the “outside.” This is a time-honored task in computer science – programs get all twisted and crufty over time as they’re modified and maintained, and every once in a while you have to straighten things out so you can continue working on them easily and reduce bugs.

This book absolutely delivers on the promise. It’s full of “strategies” to re-organize code and make it flow better and be easier to understand.

The only downside (?) is that it’s not a passive book. There are lots of code snippets (in Java) where you have to compare before and after, and follow as the author moves code around and explains why this is better. You get a feel for what he’s doing after a while, but this isn’t a book where you can just kind of lay back and zone out. To get anything out of it, you need to be in this.

(Also: this book is absolutely, 100% object-oriented. All the strategies are specific to OO code, so if you’re doing something else – like functional programming – I doubt there’s much here that would help you.)

In addition to the practical strategies, I enjoyed the implied philosophy behind it. The author makes a general, overall case for writing good code, thinking clearly about what you’re doing, and not being afraid to fix things that have gone bad.

Book Info

Martin Fowler
431

This is item #283 in a sequence of 760 items.

You can use your left/right arrow keys to navigate