Hook Method

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 } }

EditText of this page (last edited August 27, 2002) or FindPage with title or text search