Types of Design Patterns
Type |
Design Pattern |
Description |
Creational |
Singleton |
Ensures a class has only one instance. |
Factory Method |
Defines an interface for creating objects but lets subclasses
decide the instantiation. |
|
Abstract Factory |
Provides an interface for creating families of related objects. |
|
Builder |
Separates object construction from its representation. |
|
Prototype |
Creates new objects by copying an existing object. |
|
Structural |
Allows incompatible interfaces to work together. |
|
|
Bridge |
Decouples abstraction from implementation. |
|
Composite |
Organizes objects into tree structures. |
|
Decorator |
Adds new behaviors to objects dynamically. |
|
Facade |
Provides a simplified interface to a complex system. |
|
Flyweight |
Minimizes memory usage by sharing objects. |
|
Proxy |
Controls access to another object. |
Behavioral |
Chain of Responsibility |
Passes a request along a chain of handlers. |
|
Command |
Encapsulates a request as an object. |
|
Interpreter |
Defines a grammar and an interpreter for a language. |
|
Iterator |
Provides sequential access to elements of a collection. |
|
Mediator |
Centralizes communication between objects. |
|
Memento |
Captures and restores an object's state. |
|
Observer |
Notifies dependent objects of state changes. |
|
State |
Allows an object to change behavior when its state changes. |
|
Strategy |
Defines interchangeable algorithms. |
|
Template Method |
Defines the skeleton of an algorithm, allowing steps to be
customized. |
|
Visitor |
Allows adding new operations to objects without modifying them. |
Comments
Post a Comment