April 2004
Intermediate to advanced
520 pages
10h 10m
English
This pattern was previously described in GoF95.
The Template Method pattern is one of the simplest and most frequently used design patterns in object-oriented applications.
The Template Method pattern can be used in situations when there is an algorithm, some steps of which could be implemented in multiple different ways. In such scenarios, the Template Method pattern suggests keeping the outline of the algorithm in a separate method referred to as a template method inside a class, which may be referred to as a template class, leaving out the specific implementations of the variant portions (steps that can be implemented in multiple different ways) of the algorithm to different subclasses of this class.
The Template ...