Design Pattern Example in Various Language
Design patterns represent the best practices used by experienced object-oriented software developers. Design patterns are solutions to general problems that software developers faced during software development. These solutions were obtained by trial and error by numerous software developers over quite a substantial period of time.
We can group design pattern into three categories.
These design patterns provide a way to create objects while hiding the creation logic, rather than instantiating objects directly using new operator. This gives program more flexibility in deciding which objects need to be created for a given use case.
These design patterns concern class and object composition. Concept of inheritance is used to compose interfaces and define ways to compose objects to obtain new functionalities.
These design patterns are specifically concerned with communication between objects.
There is example design pattern for every type.
Type | Example |
---|---|
Structural Patterns | Adapter |
Bridge | |
Composite | |
Decorator | |
Facade | |
Flyweight | |
Proxy | |
Creational Patterns | Abstract Factory |
Builder | |
Factory Method | |
Object Pool | |
Prototype | |
Singleton | |
Behavioral Patterns | Chain of Responsibility |
Interpreter | |
Iterator | |
Mediator | |
Memento | |
Null Object | |
Observer | |
State | |
Strategy | |
Template Method | |
Visitor |