Template Design Pattern also called Template Method is one of the Behavioral Design Patterns. It is very common and well known way to reduce the possibility of having to do something many times in cases where you have implementations of very similar algorithms.
The Template Method should be use to implement invariant parts of an algorithm once and leave the subclasses to implement the behaviour that can very.
Implementation
The implementation is very simple. It requires an abstract class with methods handling the different steps of an algorithm by using methods that could be overridden by the subclasses and a template method which defines the skeleton of an algorithm.
The template method shouldn’t be overridden!
Concrete implementations of the abstract class will be needed as well.
So, lets see simple implementation written in Java.
So, when you want to use your implementations just initialize them and call the templete method on the instance.