design patters cue card
Jul. 5th, 2022 10:10 amIndex:
AbstractFactory
Adapter
Action
Behavioral
Bridge
Builder
Chain of Responsibility
Command
Composite
Creational
Cursor
Decorator
Dependents
Facade
Factory Method
Flyweight
Handle/Body
Interpreter
Iterator
Kit
Mediator
Memento
Objects for States
Observer
Prototype
Proxy
Publish/Subscribe
Singleton
State
Structural
Surrogate
Template
Token
Transaction
Virtual Constructor
Visitor
Wrapper
This card is based on Design Patterns by
Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides.
I had this stuff in myjavatools.com, the site that I closed several years ago.
AbstractFactory
Adapter
Action
Behavioral
Bridge
Builder
Chain of Responsibility
Command
Composite
Creational
Cursor
Decorator
Dependents
Facade
Factory Method
Flyweight
Handle/Body
Interpreter
Iterator
Kit
Mediator
Memento
Objects for States
Observer
Prototype
Proxy
Publish/Subscribe
Singleton
State
Structural
Surrogate
Template
Token
Transaction
Virtual Constructor
Visitor
Wrapper
Creational |
||
AbstractFactory aka Kit | Instantiates a class that is determined at runtime |
|
FactoryMethod aka Virtual Constructor | Lets subclasses do object creation: constructor does not help if you do not know the concrete class |
|
Builder | A class that is called to build another class, e.g. document with SAX |
|
Prototype | "Prototypical instance" that is used to make new objects by copying |
|
Singleton | Ensures having one instance per class; get, find, or create returns the same object; constructor is private |
|
Structural |
||
Adapter aka Wrapper | Converts one interface to another |
|
Bridge aka Handle/Body | Separates multiiple implementations; cf. abstract factory + adapter |
|
Composite | Represents "part-whole" hierarchy |
|
Decorator aka Wrapper | Adds functionality to an existing class |
|
Facade | Unified interface to a set of interfaces; provides simple inteface to complex subsystems; decouples subsystems from clients; use for layering |
|
Flyweight | Use it for sharing to support large numbers of objects |
|
Proxy aka Surrogate | Use to control access to another object |
|
Behavioral |
||
Chain of Responsibility | Decouples sender from receiver; use when the actual request handler may not be know in advance |
|
Command aka Action, Transaction | Encapsulates request arguments as an object; good for parameterized actions, undo, queue requests, logging, transactions |
|
Interpreter | Intereprets a language |
|
Iterator aka Cursor | Provides sequential access to elements of an aggregate object |
|
Mediator | Redirects messages, like a PBX. Use it when a distributed behavior should be customizable without subclassing |
|
Memento aka Token | A snapshot of a state; good for undo and when a direct interface for object state whould break encapsulation |
|
Observer aka Dependent, Publish/Subscribe | Good when a change in one object requires changes in others, which need to be notified |
|
State aka Objects for States | Encapsulates changing behavior to avoid switch; use when behavior depends on states, e.g. with large, multipart conditionals |
This card is based on Design Patterns by
Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides.
I had this stuff in myjavatools.com, the site that I closed several years ago.