You are on page 1of 1

What Varies?

One thing to consider in choosing a design pattern is what will vary in a design. Instead of looking at the cause of
redesign, this approach looks at what you want to be able to change without redesign. As you will see, the focus
switches to encapsulating the concept that varies. Table below shows the nine design patterns this book explains divided
into purpose, scope, and aspects of the pattern that can vary.
Design pattern purpose, scope, and variation
Purpose
Creative
Structural

Scope
Class
Object
Class
Object

Behavioral Class
Object
Object
Object
Object

Name
Factory
Prototype
Adapter*
Adapter*
Decorator
Template Method
State
Strategy
Chain of Responsibility
Observer

What can vary


Method Subclass of object instantiated
Class of object instantiated
Interface of object
Object responsibility without subclassing

Steps in algorithm
States of objects
An algorithm
Object that can fulfill request
Number of objects that depend on other objects; how many
dependent objects can stay up to date
*The Adapter pattern has two configurations: one class and one object.

You might also like