Template Method |
GoF |
Behavioral |
Let a descendant redefine certain tasks without modifying the basic algorithm defined by an ancestor method.
1. Break out primitive steps into separate methods in ancestor class.
2. Construct method for basic algorithm in ancestor that calls the primitive methods.
3. Override the primitive methods in descendant classes to implement specific tasks.