The template method pattern provides a framework for implementing an algorithm, providing a default
implementation that can be later on modified in subclasses.
Let me clear this out a little bit, suppose that you need to create an algorithm for assembling a computer.
Essentially, you have a method for replacing the motherboard, a method for assembling the memory to
the motherboard, one for attaching the processor, so on and so forth for all the other components
of a computer.
Using this pattern, we provide a common way for assembling a computer, but if something in the architecture
of a computer changes, we can modify that template class in a subclass.
But essentially the sequence of operations will remain the same.
Here is the UML diagram for this pattern.
We have the computer template, abstract class alongside all its methods.
We extend this class in a tower, computer class and a quantum computer class.
Those two classes will extend the template class, however, they will provide some elements that are
specific to their types.
Let's see how this looks like in the code.