|
Annex B: Design PatternsB10.Template MethodDescriptionWhen an algorithm has variable stages according to the context, this pattern proposes to delegate to subclasses the concrete realisation of these stages. Structure and Components
Structure and Components of the Template Method design pattern
CollaborationsThe client launches the algorithm in which the invariant part is executed directly, whereas the variable stages are carried out in a specific way by the operations defined in a concrete class.
Collaborations of the Template Method design patternStrengths and Weaknessesallows to establish once and for all the structure of an algorithm and invariable parts which will be shared, allows to personalise certain parts of an algorithm in subclasses, the stages delegated to the subclasses must be selected carefully to be really useful, problem of verifivation of the assumptions made by the base class which can be violated by the implementation in a subclass. Use in CBR*ToolsThis pattern is used in the phases of reasoning and the protocol of indexing in order to offer open algorithms and protocols. Brigitte Trousse Last modified: Fri Sep 28 13:52:40 MEST 2001 |