I. Class Diagram
Ii. Intention
DefineAlgorithmAnd delay some steps to the subclass.Te m p l a t e m e t h o dThis allows subclass to redefine certain steps of an algorithm without changing the structure of an algorithm.
Iii. Applicability
A) Implement the unchanged part of an algorithm at one time and leave the variable behavior to the subclass for implementation.
B) The Public behaviors in each subclass should be extracted and centralized into a public parent class to avoidCodeDuplicate.
C) control subclass extension. The template method is called only at a specific point."H o k"Operation.
Iv. Instances
the most commonly used template mode is in Dao mode. We usually write a lot of Dao class, our approach is to Dao total methods in abstract to one abstractdao , the direct benefit is code saving. The code is not listed. If you do not know the code, you can learn it online Dao mode is also a common mode.