Uh-oh, it looks like your Internet Explorer is out of date.

For a better shopping experience, please upgrade now.

Refactoring to Patterns (The Addison-Wesley Signature Series) / Edition 1

Refactoring to Patterns (The Addison-Wesley Signature Series) / Edition 1

4.0 5
by Joshua Kerievsky, Martin Fowler, Ralph Johnson

See All Formats & Editions

ISBN-10: 0321213351

ISBN-13: 9780321213358

Pub. Date: 08/19/2004

Publisher: Addison-Wesley

In 1994, Design Patterns changed the landscape of object-oriented development by introducing classic solutions to recurring design problems. In 1999, Refactoring revolutionized design by introducing an effective process for improving code. With the highly anticipated Refactoring to Patterns , Joshua Kerievsky has changed our approach to


In 1994, Design Patterns changed the landscape of object-oriented development by introducing classic solutions to recurring design problems. In 1999, Refactoring revolutionized design by introducing an effective process for improving code. With the highly anticipated Refactoring to Patterns , Joshua Kerievsky has changed our approach to design by forever uniting patterns with the evolutionary process of refactoring.

This book introduces 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. Using code from real-world projects, Kerievsky documents the thinking and steps underlying over two dozen pattern-based design transformations. Along the way he offers insights into pattern differences and how to implement patterns in the simplest possible ways.

Coverage includes:

  • A catalog of twenty-seven pattern-directed refactorings, featuring real-world code examples
  • Descriptions of twelve design smells that indicate the need for this book’s refactorings
  • General information and new insights about patterns and refactoring
  • Detailed implementation mechanics: how low-level refactorings are combined to implement high-level patterns
  • Multiple ways to implement the same pattern—and when to use each
  • Practical ways to get started even if you have little experience with patterns or refactoring

Refactoring to Patterns reflects three years of refinement and the insights of more than sixty software engineering thought leaders in the global patterns, refactoring, and agile development communities. Whether you’re focused on legacy or “greenfield” development, this book will make you a better software designer by helping you learn how to make important design changes safely and effectively.

Product Details

Publication date:
Addison-Wesley Signature Series (Fowler) Series
Edition description:
New Edition
Sales rank:
Product dimensions:
7.00(w) x 9.30(h) x 1.00(d)

Table of Contents

Foreword by Ralph Johnson.

Foreword by Martin Fowler.


What Is This Book About?

What Are the Goals of This Book?

Who Should Read This Book?

What Background Do You Need?

How to Use This Book.

The History of This Book.

Standing on the Shoulders of Giants.


1. Why I Wrote This Book.


The Patterns Panacea.


Test-Driven Development and Continuous Refactoring.

Refactoring and Patterns.

Evolutionary Design.

2. Refactoring.

What Is Refactoring?

What Motivates Us to Refactor?

Many Eyes.

Human-Readable Code.

Keeping It Clean.

Small Steps.

Design Debt.

Evolving a New Architecture.

Composite and Test-Driven Refactorings.

The Benefits of Composite Refactorings.

Refactoring Tools.

3. Patterns.

What Is a Pattern?

Patterns Happy.

There Are Many Ways to Implement a Pattern.

Refactoring to, towards, and away from Patterns.

Do Patterns Make Code More Complex?

Pattern Knowledge.

Up-Front Design with Patterns.

4. Code Smells.

Duplicated Code.

Long Method.

Conditional Complexity.

Primitive Obsession.

Indecent Exposure.

Solution Sprawl.

Alternative Classes with Different Interfaces.

Lazy Class.

Large Class.

Switch Statements.

Combinatorial Explosion.

Oddball Solution.

5. A Catalog of Refactorings to Patterns.

Format of the Refactorings.

Projects Referenced in This Catalog.

A Starting Point.

A Study Sequence.

6. Creation.

Replace Constructors with Creation Methods.

Move Creation Knowledge to Factory.

Encapsulate Classes with Factory.

Introduce Polymorphic Creation with Factory Method.

Encapsulate Composite with Builder.

Inline Singleton.

7. Simplification.

Compose Method.

Replace Conditional Logic with Strategy.

Move Embellishment to Decorator.

Replace State-Altering Conditionals with State 166

Replace Implicit Tree with Composite.

Replace Conditional Dispatcher with Command.

8. Generalization.

Form Template Method.

Extract Composite.

Replace One/Many Distinctions with Composite.

Replace Hard-Coded Notifications with Observer.

Unify Interfaces with Adapter.

Extract Adapter.

Replace Implicit Language with Interpreter.

9. Protection.

Replace Type Code with Class.

Limit Instantiation with Singleton.

10. Accumulation.

Move Accumulation to Collecting Parameter.

Move Accumulation to Visitor.

11. Utilities.

Chain Constructors.

Unify Interfaces.

Extract Parameter.

Afterword by John Brant and Don Roberts.



Customer Reviews

Average Review:

Post to your social network


Most Helpful Customer Reviews

See all customer reviews

Refactoring to Patterns 4 out of 5 based on 0 ratings. 5 reviews.
Anonymous More than 1 year ago
Anonymous More than 1 year ago
Guest More than 1 year ago
There seems to be a common misconception that Refactoring and Patterns are disconnected things. I had high hopes that this would be the book that cleared this misconception and tied them together. But I found the examples to be contrived, and often not deserving of the patterns that were applied. The step-by-step examples were hard to follow as they constantly gave tiny snippets of code that were missing proper context. As important as I think this topic and message is, I can't imagine this book convincing anyone who wasn't already convinced. At best, this might make a passable supplement to someone learning patterns for the first time from another source. On the bright side, some of the stories in the early chapters were entertaining, but not enough to recommend this derivative work.
Guest More than 1 year ago
This is a recent book in Martin Fowler's series of computing texts. The series begins with his classic Refactoring text. Now Kerievsky takes us into a sequel. Because you can imagine this as a suitable extension of the previous book. Where now the author has us look for patterns during the refactoring process. The style of the book closely follows Fowler's book. And, like that book, the code examples are in Java. But what if you program in C++ or C#? If you are experienced enough, you should be able to apply many of these ideas in your language. The examples are meant to give flesh to general patterns. And the patterns should be able to be implemented in any object oriented language. Actually, if you have already been looking for patterns, or designing to them, then much of this book may be no surprise. Because one virtue of the book is that it binds together a set of commonly encountered refactorings. But even in this case, a few hours reading may be profitable for you, if it just exposes you to a few hitherto unfamiliar patterns.
Guest More than 1 year ago
Based on its title alone I had high expectations for this book. It didn¿t disappoint. The book takes two of the most important advances of the past decade (patterns and refactoring) and puts them together into a whole that is definitely more than the sum of its parts. I¿ve read many good patterns books and have been applying patterns to how I think and talk about software since the original ¿Design Patterns¿ book in 1995. However, something was always missing. Through my consulting work, whenever I introduced patterns to a new team they would take quickly to the idea and patterns would become part of how they thought¿but only when designing, not when coding. Since we spent more time coding than designing, patterns played less of a role than they could have. This book does an excellent job of bringing patterns into coding, rather than relegating them just to design discussions. As the author points out, ¿patterns are best viewed in the light of refactoring and that they are destinations best reached by applying sequences of low-level refactorings.¿ This book has earned a permanent place on my bookshelf. That is, when it¿s not open beside me as I program. Very highly recommended!