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.
Gang of Four (GOF)
Design patterns gained popularity in computer science after the book Design Patterns: Elements of Reusable Object-Oriented Software was published in 1994 by the so-called “Gang of Four” (Gamma et al.), which is frequently abbreviated as “GoF”.
As per them..
- Program to an interface not an implementation
- Favor object composition over inheritance
Types of Design Patterns
- Creational Patterns:
These design patterns provide a way to create objects while hiding the creation logic, rather than instantiating objects directly using new opreator. This gives program more flexibility in deciding which objects need to be created for a given use case.
- Structural Patterns:
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.
- Behavioral Patterns:
These design patterns are specifically concerned with communication between objects.
Observer or Publish/Subscribe
Chain of responsibility
Details to be continued…