这一模式的正式定义为:
The Template Method Pattern defines the skeleton of an algorithm in a method, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm’s structure.
可以看出这一模式主要是关于为算法创建模板的,那什么是模板呢?书中是这么说的
A template is a method that defines an algorithm as a set of steps,and one or more of these steps is defined to be abstract and implemented by subclass。
这样就确保了算法的结构不会改变,子类会提供算法的部分实现。