In 1994, four authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides published a book named Elements of Reusable Object-Oriented Software for explaining the concept of design pattern in Software development. These four authors are communally known as Gang of Four (GOF). Gang of Four (GoF) design patterns is generally considered the foundation for all other patterns. GoF programmers define 23 Design Pattern and are categorized into 3 groups.
- Creational Patterns: deal mainly with creation of Classes & Objects.
- Structural Patterns: deal with Class & Object Composition.
- Behavioral Patterns: deal with Class & Object communication.
Creational Design Patterns
These patterns deal with the creation of objects & classes in such a way that they can be decoupled from their implementing system. It provides more flexibility in deciding which objects need to be created for a given use case. There are as follows:
- Factory Method: Create instances of derived classes
- Abstract Factory: Create instances of several classes belonging to different families
- Builder: Separates an object construction from its representation
- Prototype: Create a duplicate object or clone of the object
- Singleton: Ensures that a class can has only one instance
Structural Design Patterns
These patterns deal with the composition of Class & Object structures. The concept of inheritance is used to compose interfaces and define various ways to compose objects for obtaining new functionalities. There are as follows:
- Adapter: Match interfaces of different classes
- Bridge: Separates an object’s abstraction from its implementation
- Composite: A tree structure/parent child of simple and composite objects
- Decorator: Add responsibilities to objects dynamically
- Façade: A single class that represents an entire complex system
- Flyweight: Minimize memory usage by sharing as much data as possible with similar objects
- Proxy: Provides a surrogate object, which references to other object
Behavioral Design Patterns
These patterns deal with Class & Object communication. There are as follows:
- Chain of Responsibility: 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
- Visitor: Defines a new operation to a class without change
- Template Method: Defer the exact steps of an algorithm to a subclass
That’s all about gof pattern.
Its really helpful article. If possible give at list one example “how to use it in asp.net c#”
Thanks for share.