Design pattern provides a general reusable solution for the common problems that occur in software design. The pattern typically shows relationships and interactions between classes or objects.
These patterns are categorized into Structure, Creation and Behavior. This is a list of design pattern and their practical implementations.
Template Method Design Pattern
In simple words, a template method design pattern is a behavioral design pattern that defines the basic skeleton (steps) of an algorithm. In this pattern, we can change the behavior of individual steps in the derived class but can not change the sequence by which each method will be called
The real world examples are;
As the name suggests, this design pattern is used to build complex objects in a step by step approach. Using the same construction process we can make different representations of the object.
Suppose we have to build an object with a lot of different configurations based on a scenario. For example, we have to send an Email where we have optional properties like CC (carbon copy), BCC (blind carbon copy), attachments etc.
The real world examples are;Add to favorites