Refactoring to Patterns View Larger Image | Joshua Kerievsky Addison-Wesley, Hardcover, Published August 2004, 367 pages, ISBN 0321213351 | List Price: $59.99 Our Price: $46.50 You Save: $13.49 (22% Off)
| | | Availability: Out-Of-Stock |
Read an excerpt:
Chapter 2: Refactoring
Excerpt provided courtesy of Addison-Wesley Professional. Copyright © Addison-Wesley. Written permission from the publisher is required for any use of this material.
|
Customer Reviews: 3 Average Customer Rating:      Write a Review and tell the world about this title! People who purchase this book frequently purchase: - Head First Design Patterns; Eric Freeman, et al, $28.50, 37% Off!
- Refactoring: Improving the Design of Existing Code; Martin Fowler, et al, $46.50, 22% Off!
- Patterns of Enterprise Application Architecture; Martin Fowler, $50.50, 22% Off!
- Code Complete, 2nd Edition; Steve McConnell, $31.50, 37% Off!
Books on similar topics, in best-seller order:Books from the same publisher, in best-seller order:
Now the connection between software patterns and agile development is finally
told.
Ward Cunningham
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 books
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 patternand 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 youre 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.
Table of Contents
Foreword by Ralph Johnson.
Foreword by Martin Fowler.
Preface.
What Is Refactorings To Patterns?
What Are The Goals Of This Book?
Who Is This Book For?
What Background Do You Need?
How To Use This Book.
History of This Book.
Standing On The Shoulders Of Giants.
Acknowledgements.
1. Why I Wrote This Book.
Over-Engineering.
The Patterns Panacea.
Under-Engineering.
Test-Driven Development & Continuous Refactoring.
Refactoring & 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.
Refactoring To A New Architecture.
Composite & Test-Driven Refactorings.
Benefits of Composite Refactorings.
Tools.
3. Patterns.
What Is A Pattern?
Patterns Happy.
There Are Many Ways To Implement A Pattern.
Refactoring To, Towards or Away From Patterns.
Do Patterns Make Code More Complex?
Pattern Knowledge.
Upfront 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.
Motivation.
Mechanics.
Example.
Variations.
Parameterized Creation Methods.
Extract Factory.
Move Creation Knowledge to Factory.
Motivation.
Mechanics.
Example.
Encapsulate Classes with Factory.
Motivation.
Mechanics.
Example.
Variations.
Encapsulating Inner Classes.
Introduce Polymorphic Creation with Factory Method.
Motivation.
Mechanics.
Example.
Encapsulate Composite with Builder.
Motivation.
Mechanics.
Example.
Improving A Builder.
Variations.
A Schema-Based Builder.
Inline Singleton.
Motivation.
Mechanics.
Example.
7. Simplification.
Compose Method.
Motivation.
Mechanics.
Example.
Replace Conditional Logic with Strategy.
Motivation.
Mechanics.
Example.
Move Embellishment to Decorator.
Motivation.
Mechanics.
Example.
Replace State-Altering Conditionals with State.
Motivation.
Mechanics.
Example.
Replace Implicit Tree with Composite.
Motivation.
Mechanics.
Example.
Replace Conditional Dispatcher with Command.
Motivation.
Mechanics.
Example.
8. Generalization.
Form Template Method.
Motivation.
Mechanics.
Example.
Extract Composite.
Motivation.
Mechanics.
Example.
Replace One/Many Distinctions with Composite.
Motivation.
Mechanics.
Example.
Replace Hard-Coded Notifications with Observer.
Motivation.
Mechanics.
Example.
Unify Interfaces with Adapter.
Motivation.
Mechanics.
Example.
Extract Adapter.
Motivation.
Mechanics.
Example.
Variations.
Adapting with Anonymous Inner Classes.
Replace Implicit Language with Interpreter.
Motivation.
Mechanics.
Example.
9. Protection.
Replace Type Code with Class.
Motivation.
Mechanics.
Example.
Limit Instantiation with Singleton.
Motivation.
Mechanics.
Example.
Introduce Null Object.
Motivation.
Mechanics.
Example.
10. Accumulation.
Move Accumulation to Collecting Parameter.
Motivation.
Mechanics.
Example.
Move Accumulation to Visitor.
Motivation.
Mechanics.
External Accumulation Method.
Internal Accumulation Method.
Visitor Replacement.
Example - External Accumulation Method.
11. Utilities.
Chain Constructors.
Motivation.
Mechanics.
Example.
Unify Interfaces.
Motivation.
Mechanics.
Example.
Extract Parameter.
Motivation.
Mechanics.
Example.
12. Afterword (by John Brant and Don Roberts).
References.
Index.
About the Author
Joshua Kerievsky has been programming professionally since 1987.
He founded Industrial Logic, a company specializing in patterns, Extreme Programming
(XP), and other techniques for more successful software development. He began
his career as a professional programmer on Wall Street, where he developed numerous
financial systems for credit, market and global risk departments. Kerievsky
is an active member of the patterns and XP communities, and the author of many
articles, simulations, and games.
Customer Reviews
Customer Reviews: 3 Average Customer Rating:      Jun 8, 2006     George Mikosa from New York Really important topic, disappointing treatment of it 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.
Nov 19, 2004     sandy from NY highly recommended i have seen people going crazy about patterns and implementing all sorts of patterns to make it look good. and i have also seen redundant code, highly coupled components and so on. this book talks about both sides and gives simplistic approach to refactoring code.
Sep 19, 2004     Mike Cohn (mike@mountaingoatsoftware.com) from Boulder, CO Wonderful! Brings patterns into coding, not just designing Based on its title alone I had high expectations for this book. It didnt 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.
Ive 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 thoughtbut 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 its not open beside me as I program. Very highly recommended!
|