Design patterns can be classified in terms of the underlying problem they solve. Examples of problem-based pattern classifications include:
- Fundamental patterns
- Creational patterns
- Structural patterns
- Behavioral patterns
- Concurrency patterns
- Architectural patterns
Fundamental Patterns
- Delegation pattern - expresses certain behaviour but in reality delegates responsibility for implementing that behavior to an associated object
- Functional design - Assures that each modular part of a computer program has only one responsibility
- Interface pattern - see Bridge Pattern, Composite Pattern and Delegation Pattern
- Proxy pattern - An object representing another object
- Immutable pattern - An object whose state cannot be modified after it is created
- Marker interface pattern - Exposes some underlying semantic property of the class that cannot be determined solely by the class' methods
Creational Patterns
- Abstract Factory - Creates an instance of several families of classes
- Builder - Separates object construction from its representation
- Factory Method - Creates an instance of several derived classes
- Lazy initialization - delaying the creation of an object or some other expensive process until the first time it is needed
- Prototype - A fully initialized instance to be copied or cloned
- Singleton - A class of which only a single instance can exist
Structural Patterns
- Adapter - Match interfaces of different classes
- Aggregate - a version of the Composite pattern with methods for aggregation of children
- Bridge - Separates an object's interface from its implementation
- Composite - A tree structure of simple and composite objects
- Container - create objects for the sole purpose of holding other objects and managing them
- Decorator - Add responsibilities to objects dynamically
- Extensibility - aka. Framework - hide complex code behind a simple interface
- Facade - A single class that represents an entire subsystem
- Flyweight - A fine-grained instance used for efficient sharing
- Proxy - An object representing another object
- Pipes and Filters - a chain of processes where the output of each process is the input of the next
- Private class data - restrict accessor/mutator access
- Chain of Resp. - A way of passing a request between a chain of objects
- Command - Encapsulate a command request as an object
- Event -
- 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
- Single-serving Visitor -
- Hierarchical Visitor -
No comments:
Post a Comment