December 2015
Beginner to intermediate
195 pages
2h 52m
English
![]()
GoF Definition: 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.
In a template method, we define the minimum or essential structure of an algorithm. Then we defer some functionalities (responsibilities) to the subclasses. As a result, we can redefine certain steps of an algorithm by keeping the key structure fixed for that algorithm.
Suppose we want to make pizza. The basic mechanism is the same, but extra materials are added based ...
Read now
Unlock full access