A HookMethod is a method which is called from a TemplateMethod. Functionality of the TemplateMethod is shifted to the HookMethod to allow for customisation of the TemplateMethod's functionality by later (e.g. in a derived class) changing the HookMethod.
Example:
public class Algorithm {
public void templateMethod() {
:
.
hookMethod();
.
:
},
public void hookMethod() {
// default implementation
},
},
public class RefinedAlgorithm extends Algorithm {
public void hookMethod() {
// refined implementation
},
},