SlideShare uma empresa Scribd logo
1 de 2
+visitElementA(in a : ConcreteElementA)
+visitElementB(in b : ConcreteElementB)
«interface»
Visitor
+visitElementA(in a : ConcreteElementA)
+visitElementB(in b : ConcreteElementB)
ConcreteVisitor +accept(in v : Visitor)
«interface»
Element
+accept(in v : Visitor)
ConcreteElementA
+accept(in v : Visitor)
ConcreteElementB
Client
Visitor
Type: Behavioral
What it is:
Represent an operation to be
performed on the elements of an
object structure. Lets you define a
new operation without changing
the classes of the elements on
which it operates.
+templateMethod()
#subMethod()
AbstractClass
+subMethod()
ConcreteClass
Template Method
Type: Behavioral
What it is:
Define the skeleton of an algorithm in an
operation, deferring some steps to subclasses.
Lets subclasses redefine certain steps
of an algorithm without changing the
algorithm's structure.
+execute()
ConcreteStrategyB
+execute()
«interface»
Strategy
Context
+execute()
ConcreteStrategyA
Strategy
Type: Behavioral
What it is:
Define a family of algorithms,
encapsulate each one, and make them
interchangeable. Lets the algorithm vary
independently from
clients that use it.
+handle()
ConcreteState1
+handle()
«interface»
State
+request()
Context
+handle()
ConcreteState2
State
Type: Behavioral
What it is:
Allow an object to alter its behavior when
its internal state changes. The object will
appear to change its class.
-subjectState
ConcreteSubject
+update()
-observerState
ConcreteObserver
+update()
«interface»
Observer
notifies
observes
+attach(in o : Observer)
+detach(in o : Observer)
+notify()
«interface»
Subject
Observer
Type: Behavioral
What it is:
Define a one-to-many dependency between
objects so that when one object changes
state, all its dependents are notified and
updated automatically.
-state
Memento
+setMemento(in m : Memento)
+createMemento()
-state
Originator
Caretaker
Memento
Type: Behavioral
What it is:
Without violating encapsulation, capture
and externalize an object's internal state
so that the object can be restored to this
state later.
Abstract Factory
C
Adapter
S
Bridge
S
Builder
C
Chain of Responsibility
B
Command
B
Composite
S
Decorator
S
Facade
S
Factory Method
C
Flyweight
S
Interpreter
B
Iterator
B
Mediator
B
Memento
B
Prototype
C
Proxy
S
Observer
B
Singleton
C
State
B
Strategy
B
Template Method
B
Visitor
B
Chain of Responsibility
+handleRequest()
«interface»
Handler
+handleRequest()
ConcreteHandler1
+handleRequest()
ConcreteHandler2
Client
successor
Type: Behavioral
What it is:
Avoid coupling the sender of a request to
its receiver by giving more than one object
a chance to handle the request. Chain the
receiving objects and pass the request
along the chain until an object handles it.
+execute()
ConcreteCommand
Client
+action()
Receiver
Invoker Command
Type: Behavioral
What it is:
Encapsulate a request as an object,
thereby letting you parameterize clients
with different requests, queue or log
requests, and support undoable operations.
+interpret()
«interface»
AbstractExpression
+interpret() : Context
TerminalExpression
Client
Context
+interpret() : Context
NonterminalExpression
Interpreter
Type: Behavioral
What it is:
Given a language, define a representation
for its grammar along with an interpreter
that uses the representation to interpret
sentences in the language.
+createIterator()
«interface»
Aggregate
+createIterator() : Context
ConcreteAggregate
+next()
«interface»
Iterator
+next() : Context
ConcreteIterator
Iterator
Type: Behavioral
What it is:
Provide a way to access the elements of
an aggregate object sequentially without
exposing its underlying representation.
Client
Mediator
ConcreteMediator ConcreteColleague
«interface»
Colleague
informs
updates
Mediator
Type: Behavioral
What it is:
Define an object that encapsulates how a
set of objects interact. Promotes loose
coupling by keeping objects from referring
to each other explicitly and it lets you vary
their interactions independently.
Copyright © 2007 Jason S. McDonald
http://www.McDonaldLand.info
Gamma, Erich; Helm, Richard; Johnson, Ralph; Vlissides, John (1995). Design Patterns: Elements of
Reusable Object-Oriented Software. Reading, Massachusetts: Addison Wesley Longman, Inc..
+execute()
Command
Facade
Complex system
Adapter
Type: Structural
What it is:
Convert the interface of a class into
another interface clients expect. Lets
classes work together that couldn't
otherwise because of incompatible
interfaces.
+adaptedOperation()
Adaptee
+operation()
«interface»
Adapter
+operation()
-adaptee
ConcreteAdapter
Client
+operationImpl()
«interface»
Implementor
+operation()
Abstraction
+operationImpl()
ConcreteImplementorA
+operationImpl()
ConcreteImplementorB
Bridge
Type: Structural
What it is:
Decouple an abstraction from its
implementation so that the two can vary
independently.
+operation()
Leaf +operation()
+add(in c : Composite)
+remove(in c : Composite)
+getChild(in i : int)
Composite
+operation()
+add(in c : Composite)
+remove(in c : Composite)
+getChild(in i : int)
«interface»
Component
children
Composite
Type: Structural
What it is:
Compose objects into tree structures to
represent part-whole hierarchies. Lets
clients treat individual objects and
compositions of objects uniformly.
+operation()
ConcreteComponent
+operation()
Decorator
+operation()
«interface»
Component
+operation()
+addedBehavior()
-addedState
ConcreteDecorator
Decorator
Type: Structural
What it is:
Attach additional responsibilities to an
object dynamically. Provide a flexible
alternative to sub-classing for extending
functionality.
Facade
Type: Structural
What it is:
Provide a unified interface to a set of
interfaces in a subsystem. Defines a high-
level interface that makes the subsystem
easier to use.
Flyweight
Type: Structural
What it is:
Use sharing to support large numbers of
fine grained objects efficiently.
+request()
RealSubject
+request()
Proxy
+request()
«interface»
Subject
Client
represents
Proxy
Type: Structural
What it is:
Provide a surrogate or placeholder for
another object to control access to it.
+static instance()
+SingletonOperation()
-static uniqueInstance
-singletonData
Singleton
Singleton
Type: Creational
What it is:
Ensure a class only has one instance and
provide a global point of access to it.
+clone()
ConcretePrototype2
+clone()
«interface»
Prototype
Client
+clone()
ConcretePrototype1
Prototype
Type: Creational
What it is:
Specify the kinds of objects to create
using a prototypical instance, and
create new objects by copying this
prototype.
«interface»
Product
ConcreteProduct
+factoryMethod()
ConcreteCreator
+factoryMethod()
+anOperation()
Creator
Factory Method
Type: Creational
What it is:
Define an interface for creating an
object, but let subclasses decide which
class to instantiate. Lets a class defer
instantiation to subclasses.
+buildPart()
«interface»
Builder
+buildPart()
+getResult()
ConcreteBuilder
+construct()
Director
Builder
Type: Creational
What it is:
Separate the construction of a
complex object from its representing
so that the same construction
process can create different
representations.
«interface»
AbstractProduct
ConcreteProduct
+createProductA()
+createProductB()
«interface»
AbstractFactory
+createProductA()
+createProductB()
ConcreteFactory
Client
Abstract Factory
Type: Creational
What it is:
Provides an interface for creating
families of related or dependent
objects without specifying their
concrete class.
+operation(in extrinsicState)
-intrinsicState
ConcreteFlyweight
+operation(in extrinsicState)
-allState
UnsharedConcreteFlyweight
+operation(in extrinsicState)
«interface»
Flyweight
+getFlyweight(in key)
FlyweightFactory
Client
Copyright © 2007 Jason S. McDonald
http://www.McDonaldLand.info
Gamma, Erich; Helm, Richard; Johnson, Ralph; Vlissides, John (1995). Design Patterns: Elements of
Reusable Object-Oriented Software. Reading, Massachusetts: Addison Wesley Longman, Inc..

Mais conteúdo relacionado

Semelhante a Unveiling Design Patterns: A Visual Guide with UML Diagrams

react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryjanet736113
 
SwiftUI와 TCA로 GitHub Search앱 만들기
SwiftUI와 TCA로 GitHub Search앱 만들기SwiftUI와 TCA로 GitHub Search앱 만들기
SwiftUI와 TCA로 GitHub Search앱 만들기규영 허
 
Overview of Microsoft .Net Remoting technology
Overview of Microsoft .Net Remoting technologyOverview of Microsoft .Net Remoting technology
Overview of Microsoft .Net Remoting technologyPeter R. Egli
 
Validate your entities with symfony validator and entity validation api
Validate your entities with symfony validator and entity validation apiValidate your entities with symfony validator and entity validation api
Validate your entities with symfony validator and entity validation apiRaffaele Chiocca
 
Patterns of Enterprise Application Architecture (by example)
Patterns of Enterprise Application Architecture (by example)Patterns of Enterprise Application Architecture (by example)
Patterns of Enterprise Application Architecture (by example)Paulo Gandra de Sousa
 
Reactive clean architecture
Reactive clean architectureReactive clean architecture
Reactive clean architectureViktor Nyblom
 
Il 09 T3 William Spreitzer
Il 09 T3 William SpreitzerIl 09 T3 William Spreitzer
Il 09 T3 William Spreitzerwspreitzer
 
GWT.create 2013: Introduction to GXT
GWT.create 2013: Introduction to GXTGWT.create 2013: Introduction to GXT
GWT.create 2013: Introduction to GXTniloc132
 
PDC Video on C# 4.0 Futures
PDC Video on C# 4.0 FuturesPDC Video on C# 4.0 Futures
PDC Video on C# 4.0 Futuresnithinmohantk
 
The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84Mahmoud Samir Fayed
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Jonas Follesø
 

Semelhante a Unveiling Design Patterns: A Visual Guide with UML Diagrams (20)

react-slides.pdf
react-slides.pdfreact-slides.pdf
react-slides.pdf
 
react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react library
 
1204csharp
1204csharp1204csharp
1204csharp
 
SwiftUI와 TCA로 GitHub Search앱 만들기
SwiftUI와 TCA로 GitHub Search앱 만들기SwiftUI와 TCA로 GitHub Search앱 만들기
SwiftUI와 TCA로 GitHub Search앱 만들기
 
Overview of Microsoft .Net Remoting technology
Overview of Microsoft .Net Remoting technologyOverview of Microsoft .Net Remoting technology
Overview of Microsoft .Net Remoting technology
 
Validate your entities with symfony validator and entity validation api
Validate your entities with symfony validator and entity validation apiValidate your entities with symfony validator and entity validation api
Validate your entities with symfony validator and entity validation api
 
PoEAA by Example
PoEAA by ExamplePoEAA by Example
PoEAA by Example
 
Patterns of Enterprise Application Architecture (by example)
Patterns of Enterprise Application Architecture (by example)Patterns of Enterprise Application Architecture (by example)
Patterns of Enterprise Application Architecture (by example)
 
Reactive clean architecture
Reactive clean architectureReactive clean architecture
Reactive clean architecture
 
2.dynamic
2.dynamic2.dynamic
2.dynamic
 
Interface
InterfaceInterface
Interface
 
Devoxx 2012 (v2)
Devoxx 2012 (v2)Devoxx 2012 (v2)
Devoxx 2012 (v2)
 
Il 09 T3 William Spreitzer
Il 09 T3 William SpreitzerIl 09 T3 William Spreitzer
Il 09 T3 William Spreitzer
 
react-slides.pptx
react-slides.pptxreact-slides.pptx
react-slides.pptx
 
GWT.create 2013: Introduction to GXT
GWT.create 2013: Introduction to GXTGWT.create 2013: Introduction to GXT
GWT.create 2013: Introduction to GXT
 
PDC Video on C# 4.0 Futures
PDC Video on C# 4.0 FuturesPDC Video on C# 4.0 Futures
PDC Video on C# 4.0 Futures
 
Design Pattern Cheatsheet
Design Pattern CheatsheetDesign Pattern Cheatsheet
Design Pattern Cheatsheet
 
Intake 37 linq3
Intake 37 linq3Intake 37 linq3
Intake 37 linq3
 
The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008
 

Último

CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...Neo4j
 
Software Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements EngineeringSoftware Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements EngineeringPrakhyath Rai
 
The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)Roberto Bettazzoni
 
Spring into AI presented by Dan Vega 5/14
Spring into AI presented by Dan Vega 5/14Spring into AI presented by Dan Vega 5/14
Spring into AI presented by Dan Vega 5/14VMware Tanzu
 
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...drm1699
 
Incident handling is a clearly defined set of procedures to manage and respon...
Incident handling is a clearly defined set of procedures to manage and respon...Incident handling is a clearly defined set of procedures to manage and respon...
Incident handling is a clearly defined set of procedures to manage and respon...Varun Mithran
 
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Andreas Granig
 
Transformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with LinksTransformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with LinksJinanKordab
 
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...naitiksharma1124
 
From Theory to Practice: Utilizing SpiraPlan's REST API
From Theory to Practice: Utilizing SpiraPlan's REST APIFrom Theory to Practice: Utilizing SpiraPlan's REST API
From Theory to Practice: Utilizing SpiraPlan's REST APIInflectra
 
Auto Affiliate AI Earns First Commission in 3 Hours..pdf
Auto Affiliate  AI Earns First Commission in 3 Hours..pdfAuto Affiliate  AI Earns First Commission in 3 Hours..pdf
Auto Affiliate AI Earns First Commission in 3 Hours..pdfSelfMade bd
 
Workshop - Architecting Innovative Graph Applications- GraphSummit Milan
Workshop -  Architecting Innovative Graph Applications- GraphSummit MilanWorkshop -  Architecting Innovative Graph Applications- GraphSummit Milan
Workshop - Architecting Innovative Graph Applications- GraphSummit MilanNeo4j
 
A Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdfA Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdfICS
 
Weeding your micro service landscape.pdf
Weeding your micro service landscape.pdfWeeding your micro service landscape.pdf
Weeding your micro service landscape.pdftimtebeek1
 
Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Maxim Salnikov
 
Your Ultimate Web Studio for Streaming Anywhere | Evmux
Your Ultimate Web Studio for Streaming Anywhere | EvmuxYour Ultimate Web Studio for Streaming Anywhere | Evmux
Your Ultimate Web Studio for Streaming Anywhere | Evmuxevmux96
 

Último (20)

Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
 
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
 
Software Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements EngineeringSoftware Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements Engineering
 
The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)
 
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
Abortion Pill Prices Turfloop ](+27832195400*)[ 🏥 Women's Abortion Clinic in ...
 
Spring into AI presented by Dan Vega 5/14
Spring into AI presented by Dan Vega 5/14Spring into AI presented by Dan Vega 5/14
Spring into AI presented by Dan Vega 5/14
 
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
 
Incident handling is a clearly defined set of procedures to manage and respon...
Incident handling is a clearly defined set of procedures to manage and respon...Incident handling is a clearly defined set of procedures to manage and respon...
Incident handling is a clearly defined set of procedures to manage and respon...
 
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
 
Transformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with LinksTransformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with Links
 
Abortion Clinic In Springs ](+27832195400*)[ 🏥 Safe Abortion Pills in Springs...
Abortion Clinic In Springs ](+27832195400*)[ 🏥 Safe Abortion Pills in Springs...Abortion Clinic In Springs ](+27832195400*)[ 🏥 Safe Abortion Pills in Springs...
Abortion Clinic In Springs ](+27832195400*)[ 🏥 Safe Abortion Pills in Springs...
 
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
 
From Theory to Practice: Utilizing SpiraPlan's REST API
From Theory to Practice: Utilizing SpiraPlan's REST APIFrom Theory to Practice: Utilizing SpiraPlan's REST API
From Theory to Practice: Utilizing SpiraPlan's REST API
 
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
 
Auto Affiliate AI Earns First Commission in 3 Hours..pdf
Auto Affiliate  AI Earns First Commission in 3 Hours..pdfAuto Affiliate  AI Earns First Commission in 3 Hours..pdf
Auto Affiliate AI Earns First Commission in 3 Hours..pdf
 
Workshop - Architecting Innovative Graph Applications- GraphSummit Milan
Workshop -  Architecting Innovative Graph Applications- GraphSummit MilanWorkshop -  Architecting Innovative Graph Applications- GraphSummit Milan
Workshop - Architecting Innovative Graph Applications- GraphSummit Milan
 
A Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdfA Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdf
 
Weeding your micro service landscape.pdf
Weeding your micro service landscape.pdfWeeding your micro service landscape.pdf
Weeding your micro service landscape.pdf
 
Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?
 
Your Ultimate Web Studio for Streaming Anywhere | Evmux
Your Ultimate Web Studio for Streaming Anywhere | EvmuxYour Ultimate Web Studio for Streaming Anywhere | Evmux
Your Ultimate Web Studio for Streaming Anywhere | Evmux
 

Unveiling Design Patterns: A Visual Guide with UML Diagrams

  • 1. +visitElementA(in a : ConcreteElementA) +visitElementB(in b : ConcreteElementB) «interface» Visitor +visitElementA(in a : ConcreteElementA) +visitElementB(in b : ConcreteElementB) ConcreteVisitor +accept(in v : Visitor) «interface» Element +accept(in v : Visitor) ConcreteElementA +accept(in v : Visitor) ConcreteElementB Client Visitor Type: Behavioral What it is: Represent an operation to be performed on the elements of an object structure. Lets you define a new operation without changing the classes of the elements on which it operates. +templateMethod() #subMethod() AbstractClass +subMethod() ConcreteClass Template Method Type: Behavioral What it is: Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure. +execute() ConcreteStrategyB +execute() «interface» Strategy Context +execute() ConcreteStrategyA Strategy Type: Behavioral What it is: Define a family of algorithms, encapsulate each one, and make them interchangeable. Lets the algorithm vary independently from clients that use it. +handle() ConcreteState1 +handle() «interface» State +request() Context +handle() ConcreteState2 State Type: Behavioral What it is: Allow an object to alter its behavior when its internal state changes. The object will appear to change its class. -subjectState ConcreteSubject +update() -observerState ConcreteObserver +update() «interface» Observer notifies observes +attach(in o : Observer) +detach(in o : Observer) +notify() «interface» Subject Observer Type: Behavioral What it is: Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. -state Memento +setMemento(in m : Memento) +createMemento() -state Originator Caretaker Memento Type: Behavioral What it is: Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later. Abstract Factory C Adapter S Bridge S Builder C Chain of Responsibility B Command B Composite S Decorator S Facade S Factory Method C Flyweight S Interpreter B Iterator B Mediator B Memento B Prototype C Proxy S Observer B Singleton C State B Strategy B Template Method B Visitor B Chain of Responsibility +handleRequest() «interface» Handler +handleRequest() ConcreteHandler1 +handleRequest() ConcreteHandler2 Client successor Type: Behavioral What it is: Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it. +execute() ConcreteCommand Client +action() Receiver Invoker Command Type: Behavioral What it is: Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations. +interpret() «interface» AbstractExpression +interpret() : Context TerminalExpression Client Context +interpret() : Context NonterminalExpression Interpreter Type: Behavioral What it is: Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language. +createIterator() «interface» Aggregate +createIterator() : Context ConcreteAggregate +next() «interface» Iterator +next() : Context ConcreteIterator Iterator Type: Behavioral What it is: Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation. Client Mediator ConcreteMediator ConcreteColleague «interface» Colleague informs updates Mediator Type: Behavioral What it is: Define an object that encapsulates how a set of objects interact. Promotes loose coupling by keeping objects from referring to each other explicitly and it lets you vary their interactions independently. Copyright © 2007 Jason S. McDonald http://www.McDonaldLand.info Gamma, Erich; Helm, Richard; Johnson, Ralph; Vlissides, John (1995). Design Patterns: Elements of Reusable Object-Oriented Software. Reading, Massachusetts: Addison Wesley Longman, Inc.. +execute() Command
  • 2. Facade Complex system Adapter Type: Structural What it is: Convert the interface of a class into another interface clients expect. Lets classes work together that couldn't otherwise because of incompatible interfaces. +adaptedOperation() Adaptee +operation() «interface» Adapter +operation() -adaptee ConcreteAdapter Client +operationImpl() «interface» Implementor +operation() Abstraction +operationImpl() ConcreteImplementorA +operationImpl() ConcreteImplementorB Bridge Type: Structural What it is: Decouple an abstraction from its implementation so that the two can vary independently. +operation() Leaf +operation() +add(in c : Composite) +remove(in c : Composite) +getChild(in i : int) Composite +operation() +add(in c : Composite) +remove(in c : Composite) +getChild(in i : int) «interface» Component children Composite Type: Structural What it is: Compose objects into tree structures to represent part-whole hierarchies. Lets clients treat individual objects and compositions of objects uniformly. +operation() ConcreteComponent +operation() Decorator +operation() «interface» Component +operation() +addedBehavior() -addedState ConcreteDecorator Decorator Type: Structural What it is: Attach additional responsibilities to an object dynamically. Provide a flexible alternative to sub-classing for extending functionality. Facade Type: Structural What it is: Provide a unified interface to a set of interfaces in a subsystem. Defines a high- level interface that makes the subsystem easier to use. Flyweight Type: Structural What it is: Use sharing to support large numbers of fine grained objects efficiently. +request() RealSubject +request() Proxy +request() «interface» Subject Client represents Proxy Type: Structural What it is: Provide a surrogate or placeholder for another object to control access to it. +static instance() +SingletonOperation() -static uniqueInstance -singletonData Singleton Singleton Type: Creational What it is: Ensure a class only has one instance and provide a global point of access to it. +clone() ConcretePrototype2 +clone() «interface» Prototype Client +clone() ConcretePrototype1 Prototype Type: Creational What it is: Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype. «interface» Product ConcreteProduct +factoryMethod() ConcreteCreator +factoryMethod() +anOperation() Creator Factory Method Type: Creational What it is: Define an interface for creating an object, but let subclasses decide which class to instantiate. Lets a class defer instantiation to subclasses. +buildPart() «interface» Builder +buildPart() +getResult() ConcreteBuilder +construct() Director Builder Type: Creational What it is: Separate the construction of a complex object from its representing so that the same construction process can create different representations. «interface» AbstractProduct ConcreteProduct +createProductA() +createProductB() «interface» AbstractFactory +createProductA() +createProductB() ConcreteFactory Client Abstract Factory Type: Creational What it is: Provides an interface for creating families of related or dependent objects without specifying their concrete class. +operation(in extrinsicState) -intrinsicState ConcreteFlyweight +operation(in extrinsicState) -allState UnsharedConcreteFlyweight +operation(in extrinsicState) «interface» Flyweight +getFlyweight(in key) FlyweightFactory Client Copyright © 2007 Jason S. McDonald http://www.McDonaldLand.info Gamma, Erich; Helm, Richard; Johnson, Ralph; Vlissides, John (1995). Design Patterns: Elements of Reusable Object-Oriented Software. Reading, Massachusetts: Addison Wesley Longman, Inc..