C     Abstract Factory                           S       Facade                                       S      Proxy                                                                                                                          Memento
                                                                                                                                                  Memento
S     Adapter                                    C       Factory Method                               B      Observer                                                                               Caretaker                       -state
                                                                                                                                                  Type: Behavioral
S     Bridge                                     S       Flyweight                                   C       Singleton
                                                                                                                                                  What it is:
C     Builder                                    B       Interpreter                                  B      State                                Without violating encapsulation, capture
                                                                                                                                                  and externalize an object's internal state
                                                                                                      B      Strategy                             so that the object can be restored to this
B     Chain of Responsibility                    B       Iterator                                                                                                                                               Originator
                                                                                                                                                  state later.
B     Command                                    B       Mediator                                     B      Template Method                                                                        -state

                                                                                                      B      Visitor                                                                                +setMemento(in m : Memento)
S     Composite                                  B       Memento                                                                                                                                    +createMemento()

S     Decorator                                  C       Prototype


                                                                                                                                                                                                         «interface»
                                                                                                                                                                                                                                notifies
                                  «interface»                   successor       Chain of Responsibility                                            Observer                                               Subject                               «interface»
                                   Handler                                                                                                                                                                                                       Observer
       Client                                                                                                                                                                                     +attach(in o : Observer)
                              +handleRequest()                                  Type: Behavioral                                                   Type: Behavioral                               +detach(in o : Observer)                  +update()
                                                                                                                                                                                                  +notify()
                                                                                What it is:                                                        What it is:
                                                                                Avoid coupling the sender of a request to                          Define a one-to-many dependency between
                                                                                its receiver by giving more than one object                        objects so that when one object changes
                                                                                a chance to handle the request. Chain the                          state, all its dependents are notified and
                                                                                receiving objects and pass the request                             updated automatically.
                                                                                along the chain until an object handles it.                                                                           ConcreteSubject         observes      ConcreteObserver
                 ConcreteHandler1             ConcreteHandler2
                                                                                                                                                                                                     -subjectState                         -observerState
                 +handleRequest()            +handleRequest()
                                                                                                                                                                                                                                           +update()




        Client                                        Invoker                  Command                                                            State                                               Context
                                                                                                                                                                                                +request()
                                                                               Type: Behavioral                                                   Type: Behavioral                                                                «interface»
                                                                                                                                                                                                                                     State
                    ConcreteCommand                                            What it is:                                                        What it is:                                                                 +handle()
                    +execute()                                                 Encapsulate a request as an object,                                Allow an object to alter its behavior when
                                                                               thereby letting you parameterize clients                           its internal state changes. The object will
                                                                               with different requests, queue or log                              appear to change its class.
                                                                               requests, and support undoable operations.
                                                  Command
       Receiver
                                            +execute()                                                                                                                                                             ConcreteState1             ConcreteState2
 +action()
                                                                                                                                                                                                                  +handle()                 +handle()




        Client
                                                                               Interpreter                                                        Strategy                                            Context
                                                                                                                                                  Type: Behavioral                                                              «interface»
                                                                               Type: Behavioral                                                                                                                                  Strategy
                                 «interface»
                                                                                                                                                  What it is:
       Context               AbstractExpression                                                                                                                                                                              +execute()
                                                                               What it is:                                                        Define a family of algorithms,
                             +interpret()                                      Given a language, define a representation                          encapsulate each one, and make them
                                                                               for its grammar along with an interpreter                          interchangeable. Lets the algorithm vary
                                                                               that uses the representation to interpret                          independently from
                                                                               sentences in the language.                                         clients that use it.
                                                                                                                                                                                                              ConcreteStrategyA            ConcreteStrategyB
     TerminalExpression              NonterminalExpression                                                                                                                                                    +execute()                   +execute()
    +interpret() : Context           +interpret() : Context




                              Client
                                                                               Iterator                                                            Template Method                                                     AbstractClass

                                                                               Type: Behavioral                                                    Type: Behavioral                                                  +templateMethod()
        «interface»                             «interface»                                                                                                                                                          #subMethod()
        Aggregate                                 Iterator                                                                                         What it is:
                                                                               What it is:
    +createIterator()                       +next()                            Provide a way to access the elements of                             Define the skeleton of an algorithm in an
                                                                               an aggregate object sequentially without                            operation, deferring some steps to subclasses.
                                                                               exposing its underlying representation.                             Lets subclasses redefine certain steps
                                                                                                                                                   of an algorithm without changing the
                                                                                                                                                   algorithm's structure.                                              ConcreteClass
    ConcreteAggregate                        ConcreteIterator                                                                                                                                                        +subMethod()
+createIterator() : Context                 +next() : Context




                                                                                                                                                                                                    «interface»
                          informs
                                                 «interface»                   Mediator                                                          Visitor                                              Visitor
                                                                                                                                                                                                                                                    Client
      Mediator                                                                                                                                                                      +visitElementA(in a : ConcreteElementA)
                                                 Colleague                                                                                       Type: Behavioral
                                                                               Type: Behavioral                                                                                     +visitElementB(in b : ConcreteElementB)
                                                                                                                                                 What it is:
                                                                               What it is:                                                                                                                                                       «interface»
                                                                                                                                                 Represent an operation to be
                                                                               Define an object that encapsulates how a                                                                                                                           Element
                                                                                                                                                 performed on the elements of an                 ConcreteVisitor
                                                                               set of objects interact. Promotes loose                                                                                                                      +accept(in v : Visitor)
                                                                                                                                                 object structure. Lets you define a
                                                                               coupling by keeping objects from referring
                                                                                                                                                 new operation without changing +visitElementA(in a : ConcreteElementA)
                          updates                                              to each other explicitly and it lets you vary
                                                                                                                                                 the classes of the elements on      +visitElementB(in b : ConcreteElementB)
                                                                               their interactions independently.
ConcreteMediator                            ConcreteColleague                                                                                    which it operates.
                                                                                                                                                                                     ConcreteElementA
                                                                                                                                                                                                                        ConcreteElementB
                                                                                                                                                                                    +accept(in v : Visitor)
Copyright © 2007 Jason S. McDonald           Gamma, Erich; Helm, Richard; Johnson, Ralph; Vlissides, John (1995). Design Patterns: Elements of                                                                         +accept(in v : Visitor)
http://www.McDonaldLand.info                     Reusable Object-Oriented Software. Reading, Massachusetts: Addison Wesley Longman, Inc..
«interface»
      Adapter
                                                                 Adapter                                       Proxy                                                    Client
                                            Client
 +operation()                                                    Type: Structural                              Type: Structural
                                                                                                                                                                                                 «interface»
                                                                 What it is:                                   What it is:                                                                         Subject
                                                                 Convert the interface of a class into         Provide a surrogate or placeholder for                                      +request()
                                                                 another interface clients expect. Lets        another object to control access to it.
  ConcreteAdapter                                                classes work together that couldn't
                                           Adaptee               otherwise because of incompatible
 -adaptee                                                        interfaces.
                                     +adaptedOperation()                                                                                                                                          represents
 +operation()                                                                                                                                                         RealSubject                                                 Proxy
                                                                                                                                                                 +request()                                             +request()




     Abstraction                                                                                                                                                                                     Client
                                                                 Bridge                                         Abstract Factory
  +operation()
                                                                                                                                                             «interface»
                                  «interface»                    Type: Structural
                                                                                                                Type: Creational                           AbstractFactory
                                 Implementor
                                                                                                                                                         +createProductA()                                                 «interface»
                              +operationImpl()                   What it is:
                                                                                                                What it is:                              +createProductB()                                               AbstractProduct
                                                                 Decouple an abstraction from its
                                                                                                                Provides an interface for creating
                                                                 implementation so that the two can vary
                                                                                                                families of related or dependent
                                                                 independently.
                                                                                                                objects without specifying their
                                                                                                                concrete class.
                                                                                                                                                          ConcreteFactory
  ConcreteImplementorA              ConcreteImplementorB                                                                                                                                                               ConcreteProduct
                                                                                                                                                         +createProductA()
  +operationImpl()                  +operationImpl()                                                                                                     +createProductB()



                   «interface»
                                                                                                                                                                                                                    «interface»
                   Component                                     Composite                                     Builder                                               Director
                                                                                                                                                                                                                      Builder
            +operation()                          children
                                                                 Type: Structural                              Type: Creational                              +construct()                                     +buildPart()
            +add(in c : Composite)
            +remove(in c : Composite)
            +getChild(in i : int)                                What it is:                                   What it is:
                                                                 Compose objects into tree structures to       Separate the construction of a
                                                                 represent part-whole hierarchies. Lets        complex object from its representing
                                                                 clients treat individual objects and          so that the same construction
                                                                 compositions of objects uniformly.            process can create different                                                                     ConcreteBuilder
                                         Composite                                                             representations.
        Leaf                                                                                                                                                                                                  +buildPart()
                                 +operation()                                                                                                                                                                 +getResult()
 +operation()                    +add(in c : Composite)
                                 +remove(in c : Composite)
                                 +getChild(in i : int)


     «interface»
     Component
                                      ConcreteComponent          Decorator                                      Factory Method                                         «interface»                                          Creator
  +operation()                        +operation()                                                                                                                       Product                                    +factoryMethod()
                                                                 Type: Structural                               Type: Creational
                                                                                                                                                                                                                    +anOperation()
                                          Decorator              What it is:                                    What it is:
                                                                 Attach additional responsibilities to an       Define an interface for creating an
                                      +operation()               object dynamically. Provide a flexible         object, but let subclasses decide which
                                                                 alternative to sub-classing for extending      class to instantiate. Lets a class defer
                                                                 functionality.                                 instantiation to subclasses.
             ConcreteDecorator
                                                                                                                                                                                                                     ConcreteCreator
             -addedState                                                                                                                                          ConcreteProduct
                                                                                                                                                                                                                    +factoryMethod()
             +operation()
             +addedBehavior()



                                                                                                                                                                  Client
                           Facade                                Facade                                         Prototype
                                           Complex system
                                                                 Type: Structural                               Type: Creational                                                                 «interface»
                                                                                                                                                                                                 Prototype
                                                                 What it is:                                    What it is:                                                                +clone()
                                                                 Provide a unified interface to a set of        Specify the kinds of objects to create
                                                                 interfaces in a subsystem. Defines a high-     using a prototypical instance, and
                                                                 level interface that makes the subsystem       create new objects by copying this
                                                                 easier to use.                                 prototype.

                                                                                                                                                                ConcretePrototype1                                 ConcretePrototype2
                                                                                                                                                               +clone()                                           +clone()




                                          «interface»
 FlyweightFactory
                                           Flyweight
+getFlyweight(in key)            +operation(in extrinsicState)
                                                                 Flyweight                                     Singleton
                                                                                                                                                                                                   Singleton
                                                                 Type: Structural                              Type: Creational
                                                                                                                                                                                          -static uniqueInstance
       Client                                                                                                  What it is:
                                                                 What it is:                                                                                                              -singletonData
                                                                 Use sharing to support large numbers of       Ensure a class only has one instance and                                   +static instance()
                                                                 fine grained objects efficiently.             provide a global point of access to it.                                    +SingletonOperation()
              ConcreteFlyweight
         -intrinsicState
                                             UnsharedConcreteFlyweight
         +operation(in extrinsicState)
                                            -allState

                                            +operation(in extrinsicState)                                     Copyright © 2007 Jason S. McDonald      Gamma, Erich; Helm, Richard; Johnson, Ralph; Vlissides, John (1995). Design Patterns: Elements of
                                                                                                              http://www.McDonaldLand.info                Reusable Object-Oriented Software. Reading, Massachusetts: Addison Wesley Longman, Inc..

test

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