Behavioral design pattern in object-oriented programming
Not to be confused with Template processor.
This article includes a list of general references, but it lacks sufficient corresponding inline citations. Please help to improve this article by introducing more precise citations.(March 2012) (Learn how and when to remove this message)
In object-oriented programming, the template method is one of the behavioral design patterns identified by Gamma et al.[1] in the book Design Patterns. The template method is a method in a superclass, usually an abstract superclass, and defines the skeleton of an operation in terms of a number of high-level steps. These steps are themselves implemented by additional helper methods in the same class as the template method.
The helper methods may be either abstract methods, in which case subclasses are required to provide concrete implementations, or hook methods, which have empty bodies in the superclass. Subclasses can (but are not required to) customize the operation by overriding the hook methods. The intent of the template method is to define the overall structure of the operation, while allowing subclasses to refine, or redefine, certain steps.[2]
^Gamma, Erich; Helm, Richard; Johnson, Ralph; Vlissides, John (1994). "Template Method". Design Patterns. Addison-Wesley. pp. 325–330. ISBN 0-201-63361-2.
^Freeman, Eric; Freeman, Elisabeth; Sierra, Kathy; Bates, Bert (2004). Hendrickson, Mike; Loukides, Mike (eds.). Head First Design Patterns(paperback). Vol. 1. O'REILLY. pp. 289, 311. ISBN 978-0-596-00712-6. Retrieved 2012-09-12.
and 22 Related for: Template method pattern information
the templatemethod is one of the behavioral design patterns identified by Gamma et al. in the book Design Patterns. The templatemethod is a method in...
temporary source code Templatemethodpattern, an object-oriented design patternTemplate processor, a system that combines a template with data to produce...
In object oriented programming, the factory methodpattern is a creational pattern that uses factory methods to deal with the problem of creating objects...
templatepattern (CRTP) is an idiom, originally in C++, in which a class X derives from a class template instantiation using X itself as a template argument...
change its type at runtime Strategy pattern Algorithms can be selected on the fly, using composition Templatemethodpattern Describes the skeleton of a program;...
achieved with the TemplateMethodPattern. default behaviour: This can be provided with the invariant methods of the TemplateMethodPattern in an abstract...
events or messages is called a hook. Hook methods are of particular importance in the TemplateMethodPattern where common code in an abstract class can...
coupling can be refactored with the templatemethodpattern to overcome the problems posed by the usage of this anti-pattern. Andriy, Buday (15 April 2010)...
application. Callbacks, schedulers, event loops, and the templatemethod are examples of design patterns that follow the inversion of control principle, although...
of non-abstract methods and properties, such as when implementing the TemplateMethodPattern which uses a mixture of invariant methods with fixed implementations...
includes the method name, the object that owns the method and values for the method parameters. Four terms always associated with the command pattern are command...
Template matching is a technique in digital image processing for finding small parts of an image which match a template image. It can be used for quality...
Template metaprogramming (TMP) is a metaprogramming technique in which templates are used by a compiler to generate temporary source code, which is merged...
classes, methods...) and their relationships. A developer adapts the motif to their codebase to solve the problem described by the pattern. The resulting...
one of a family of algorithms to be selected on-the-fly at runtime. Templatemethod defines the skeleton of an algorithm as an abstract class, allowing...
the most common being function templates and class templates. A function template is a pattern for creating ordinary functions based upon the parameterizing...
Nanoimprint lithography (NIL) is a method of fabricating nanometer-scale patterns. It is a simple nanolithography process with low cost, high throughput...
In computer programming, the specification pattern is a particular software design pattern, whereby business rules can be recombined by chaining the business...
This pattern is designed so that multiple decorators can be stacked on top of each other, each time adding a new functionality to the overridden method(s)...