Template Method Pattern

Competency Type: Pattern

GoF Intent: Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm’s structure *

We want to abstract out a common theme from different cases that have different implementations. We eliminate redundant process by separating process from implementation, typically using abstract methods for the implementing steps, and inheriting the (concrete) process method into various cases.


*Design Patterns: Elements of Reusable Object-Oriented Software, Gamma, Helm, Johnson, Vlissides

Resources
Template Method Pattern (Article)

Links
Net Objectives Repository Page