Design Patterns
Design Patterns
Design Patterns
Design Patterns
Knowledge of design patterns is crucial for any kind of serious software development. Let's learn what they are, what they are
good for, and the names of, and basic ideas behind, a few of the more popular ones.
Patterns
"Each pattern describes a problem which occurs over and over again ... and then describes the core of the
solution to that problem, in such a way that you can use this solution a million times over, without doing it the
same way twice." -- Christopher Alexander
1/4
2/9/2014
Design Patterns
design pattern lets some aspect of the system vary independently of other aspects, thereby making a system
more robust to a particular kind of change."
elements in a pattern which know how to do one general thing very well and don't know much about anything
else.
efforts to simplify code, to make it more readable, more understandable.
a major emphasis on interfaces ("program to an interface, not to an implementation"), and on the distinction
between types and classes.
a favoring of object composition over class inheritance: too much inheritance leads to an explosion of the
number of classes in a system.
Creational
Structural
Factory Method
Adapter (class)
Interpreter
Template Method
Abstract Factory
Builder
Prototype
Singleton
Adapter (object)
Bridge
Composite
Decorator
Facade
Flyweight
Proxy
Chain of Responsibility
Command
Iterator
Mediator
Memento
Observer
State
Strategy
Visitor
Object
Behavioral
2/4
2/9/2014
Design Patterns
Strategy)
Inability to alter classes conveniently (Visitor, Decorator, Adapter)
Design Pattern
Abstract Factory
Builder
Structural
Prototype
Singleton
Adapter
interface to an object
Bridge
implementation of an object
Composite
Decorator
Facade
interface to a subsystem
Flyweight
Proxy
Chain of
Responsibility
Command
Interpreter
Iterator
Mediator
Memento
http://cs.lmu.edu/~ray/notes/designpatterns/
3/4
2/9/2014
Design Patterns
Behavioral Observer
State
states of an object
Strategy
an algorithm
Template
Method
steps of an algorithm
Visitor
http://cs.lmu.edu/~ray/notes/designpatterns/
4/4