$> git checkout template_method
Intent
Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. The template method lets subclasses redefine certain steps of an algorithm without changing the algorithm’s structure.1
Applications
The template method is useful when you have an algorithm that needs further instruction internally to run correctly. It fits well when an algorithm has steps, much like a cooking recipe. The Head First Design Patternsbook uses an example of making different caffeinated drinks. Making a cup of tea is very much like making a cup of coffee ...