Design Patterns
- In software engineering, design patterns are time-tested solutions that mean general problems that are frequent to happen while you do development and there is a certain answer for that problem that falls under design patterns.
- Now, It is not a good idea to put design patterns first place without identifying the problem.
- In short, these are like templates or a blueprint of a particular problem.
When to use it?
- Design Patterns help to speed up development as they are already a proven strategy or solution.
- Refactoring code that is much more complex in nature design patterns helps to make it more reliable and maintainable.
- It has documented problems and solutions accordingly.
Types of Design Patterns
Divided by categories to help us to share more meaningful
- Creational Patterns
- This is about class instantiation
- Also can be subdivided into class creational and objection creational patterns
- Now little talk more on class creational which uses more inheritance features of object-oriented programming
- And object creational pattern uses deligation to make them work
- Examples are Factory Pattern, Abstract Factory Pattern, Builder Pattern, Factory Method, Prototype, Singleton
- Structural Patterns
- This is about class and object composition
- Examples are Adapter, Bridge, Composite pattern, Decorator Pattern, Facade Pattern, Proxy pattern, etc.
- Behavioral Patterns
- This is above communication between objects
- Examples are Chain of Responsibility Pattern, Comand Pattern, Interpreter Pattern, Iterator Pattern, Observer Pattern, etc.