Design pattern catalog

April 1, 2009


The design patterns are mainly classified into three categories, namely Creational Patterns, Structural Patterns and Behavioral Patterns.

  1. The Creational Patterns deals with the best way to create objects. The Singleton Pattern is to only create the object, if there is one object existing, just return it; the Factory Method pattern is to create an object of a certain type, according to the input information; Anyway this pattern is only related with how to create object.
  2. Structural patterns are concerned with how classes and objects are composed to form larger structures. Here are the purposes of the seven structural patterns:
    • Add new functionality dynamically to existing objects, or remove it (Decorator).
    • Control access to an object or/and Create expensive objects on demand (Proxy).
    • Enable development of the interface and implementation of a component to pro-ceed independently or/and Select or switch implementations at runtime (Bridge).
    • Match otherwise incompatible interfaces (Adapter).
    • Reduce the cost of working with large numbers of very small objects (Flyweight).
    • Reorganize a system with many subsystems into identifiable layers with single entry points or/and Simplify the interface to a complex subsystem (Façade).
    • Treat single objects and composite objects in the same way (Composite).
  3. Behavioral patterns are concerned with algorithms and communication between them. The behavioral patterns capture ways of expressing the division of operations between classes and optimize how the communication should be handled.

 

Chain of Resp. A way of passing a request between a chain of objects
  Command   Encapsulate a command request as an object
  Interpreter   A way to include language elements in a program
  Iterator   Sequentially access the elements of a collection
  Mediator   Defines simplified communication between classes
  Memento   Capture and restore an object’s internal state
  Observer   A way of notifying change to a number of classes
  State   Alter an object’s behavior when its state changes
  Strategy   Encapsulates an algorithm inside a class
  Template Method   Defer the exact steps of an algorithm to a subclass
  Visitor   Defines a new operation to a class without change

Leave a Reply