Refactoring to Patterns
by Joshua Kerievsky
ISBN 0321213351
Date Read 5/2005
My Rating
This book had such a potential…
I thought this was going to be another classic (check Amazon.com reviews). But because of the flows it contains, it is just an OK book. The over-complicated code just ruins this superb piece of work (as another Amazon.com reviewer puts it).
This book is a lot better than Holub on Patterns, which is in the same category: learn patterns by looking at code. However, it has the same type of problems. Mainly, the author wants to illustrate how he is refactoring to patterns using real-life examples. But the examples are not easy to understand! I don’t like that approach. If I cannot understand the code easily (without too much effort), then I get lost, lose interest in the refactoring, and the potential benefit is lost.
This book is not in the same league as Core J2EE Patterns, Refactoring, Agile Software Development, and Design Patterns (GoF). (If you haven’t read them, read them before this one.) First, as I said, the code is out of context (too hard; what’s with the obsession with XML/HTML parsing?). The code is a lot simpler in Refactoring, Core J2EE Patterns, Agile Software Development. Second, the UML diagrams are not that easy to understand (you’ll find clear diagrams in Core J2EE Patterns, Agile Software Development, GoF). Third, the style of writing is OK, but not catchy. So, this book is far away from being a classic…
But this is not a bad book. You’ll get the most value out of it if you have other pattern books by your side, and if you are willing to jump into them while you are reading this one. I did that, and my knowledge about patterns deepened as a result. This book actually forces you to do that. Yeah, really. You cannot learn patterns from this book. So if you want to make sense out of what he’s saying through his code, you have to look at the other books. What other books? Other pattern books, as well as Refactoring (those mentioned above).
This book has some good advice, though. The first couple of chapters are classic. There he explains refactoring, patterns, and code smells. Just excellent. He puts a lot of good advice in the motivation section of each refactoring. We can learn a lot from them. If only the code was easy…
Overall, a decent book, filled with good advice. Based on good practices, good designs. Could have been a classic! But the flaws I mentioned take away too much out of it. There is not much this book needs to get there: leave the comments, replace the code and the UML. Maybe somebody else will do it.