Refactoring to Patterns (Addison-Wesley Signature)
Refactoring to Patterns (Addison-Wesley Signature) by Joshua Kerievsky
- Binding:
- Hardcover
- Number of Pages:
- 400
- ISBN:
- 0321213351
- Product Group:
- book
- Publisher:
- Addison Wesley
- Publication Date:
- Aug. 26, 2004
- BooksForGeeks.com ID:
- 2890
Provides an introduction to the theory and practice of pattern-directed refactorings: sequences of low-level refactorings that allow designers to safely move designs to, towards, or away from pattern implementations. This book documents the steps underlying pattern-based design transformations. It also offers insights into pattern differences.
Reviews for Refactoring to Patterns (Addison-Wesley Signature)
-
Excellent examples
Rated out of 5 stars, February 12th, 2008
This book doesn't cover the theory of patterns, it shows how to apply them to various example pieces of code. It also warns against putting patterns in everywhere, and has an excellent example on the overuse of patterns.
A lot of the patterns and refactorings in the book I had heard of before, a few I hadn't and the examples explained their usage particularly well.
This is one of those books that you can read for a few minutes at a time, as each refactoring is covered in its own section over 10 pages or so.
This is definitely one of the best patterns books I have read. -
Great book on refactoring
Rated out of 5 stars, April 12th, 2007
This book provides an insight to refactoring and how patterns can assist in the process. The author provides case studies and examples of refactoring and how to achieve it successfully. I would recommend this book and also Refactoring by Martin Fowler -
How to apply patterns
Rated out of 5 stars, January 12th, 2006
I agree with the other reviews of this book, it really does a good job of showing how refactoring to patterns can improve your designs.
Where I diverge slightly with the other reviewers is that I did find that parts of the books were very badly written, this didn't stop it being an excellent book but it was annoying. I also thought that full before/after source code would have made it much more readable, particularly for people like me who aren't used to reading densely packed Java code.
I also thought this book was a good partner to "Agile Software Development" by Robert C. Martin. -
Badly Written
Rated out of 5 stars, January 12th, 2006
Whilst the idea behind this book is sound and the author does not seem to put enough effort into making the book readable.The examples were often a little hard to understand. I liked the fact that author used examples he'd met professionally but he often doesn't give you enough context to work out whats going on.
However what really hurts this book is that the author often fails to explain things clearly. For example: "If the instantiator doesn't instantiate the product using a Creation Method, modify it and, if necessary, also modify the products class, so the instantiation occurs through a Creation Method".
-
Well written, easy to read, and genuinely useful
Rated out of 5 stars, January 12th, 2005
Refactoring To Patterns brings together the Patterns movement, and the practice of Refactoring commonplace in the Agile community. Whereas the original Gang of Four book told us what patterns were, what sort of problems they solved, and how the code might be structured, Refactoring To Patterns illustrates how, why and when to introduce patterns into an existing codebase.The opening chapters cover the background, introducing both refactoring and design patterns, and the context in which the book was written. This gives the reader a clear overview of what is involved in Refactoring to Patterns, and paves the way for the refactoring catalogue which makes up the bulk of the book.
The catalogue is divided into chapters based on the type of change required --- is this a refactoring to simplify code, generalize code, or increase encapsulation and protection? Each chapter has an introduction which gives an overview of the refactorings contained within that chapter, followed by the refactorings themselves. These introductions clearly illustrate the principles and choices which would lead one to follow the refactorings that follow.
Each refactoring starts with a brief one sentence summary, and before and after structure diagrams with reference to the structure diagrams for the relevant pattern in the Design Patterns book. The sections that follow then cover the Motivation for using this refactoring, step-by-step Mechanics, and a worked Example, relating back to the steps given for the Mechanics. Finally, some of the refactorings finish with Variations on the same theme. The examples are all pulled from a small sample of projects, which are introduced at the beginning of the catalogue section, and help illuminate the instructions given in the Mechanics section. The mechanics themselves are generally clear, and broken down into small steps --- sometimes smaller steps than I might take in practice, but I think this is probably wise, as large steps can easily confuse. Finally, the Motivation sections do a good job of explaining why one would choose to do a particular refactoring, and any pitfalls to doing so --- the "Benefits and Liabilities" tables provide a useful summary.
This book is well written, easy to read, and genuinely useful. It has helped me put some of the refactorings I do into a larger context, and given me insight into how I can integrate patterns with existing code, rather than designing them in up front. As John Brant and Don Roberts highlight in their Afterword, this is a book to study, the real benefit comes not from knowing the mechanics, but by understanding the motivation, and the process, so that one may apply the same thinking to other scenarios not covered by this book. If you are serious about software development, buy this book, inwardly digest it, and keep it by your side.
Highly Recommended.

