A Design Pattern provides a solution to a typical reoccurring problem. It’s a blueprint design that helps in eradicating a repeated specific design problem.
Design Patterns != Architecture Patterns
A lot of developers do have a misconception regarding Design Patterns. Sometimes when you mention the term “Design Patterns” in front of a developer, first thing he/she says is: “you mean MVC? MVP?“. But still sometimes these terms are used interchangeably for some Architecture Patterns. Well:
We aren’t going to get into the details of it. Just to keep things to the point.
Types of Design Patterns
There are three types of Design Patterns:
- Creational
- Structural
- Behavioural
Creational Design Patterns
Handles all the mechanism of instantiating objects. Without having the system to worry about how its objects are created. It increases the reusability of the code. These are the following patterns that falls under it:
Structural Design Patterns
Deals with objects composition. It uses inheritance to compose new objects and combining those new objects into creating more bigger and flexible classes.
- Adapter
- Bridge
- Composite
- Decorator
- Facade
- Proxy
- Flyweight
Behavioural Design Patterns
Are the ones that control the responsibilities and interactions of the objects and also how they intercommunicate.
- Chain of Responsibility
- Command
- Interpreter
- Iterator
- Mediator
- Memento
- Observer
- State
- Strategy
- Visitor
- Template Method
Design Patterns play a vital role in the development of a well-structured and testable system. It also helps with achieving a codebase which is easily extendable and maintainable. Helps with eradicating code repetitions. It helps in achieving abstraction in the system.
Even with all these advantages. It doesn’t mean Design Patterns should be applied even in the areas where there is absolutely no need of it. Brain-storming about selecting the right Design Pattern for solving a particular problem is also important while designing a system.
If you have any questions please feel free to leave them in the comment section below. :]