Template Method
Usage
- Defer the exact steps of an algorithm to a subclass
- Define the skeleton of an algorithm in an operation, deferring some steps to subclasses
- Let subclasses redefine certain steps of an algorithm without changing the algorithm's structure
Participants
AbstractClass
ConcreteClass
- Defines abstract primitive operations that concrete subclasses define to implement steps of an algorithm
- Implements a template method defining the skeleton of an algorithm
- The template method calls primitive operations as well as operations defined in AbstractClass or those of other objects
- Implements the primitive operations ot carry out subclass-specific steps of the algorithm
