Template Method: Skeletons, Recipes and Hooks
Template Method Players
This pattern brings the following players to the stage:
- Template Method: A recipe or set of steps that declares what gets done.
- Skeleton: The class containing the Template Method.
- Filler: A Skeleton subclass that fills in one or more Template Method steps.
Step | Description |
---|---|
Hook Method | A method in the Skeleton with default or do nothing behavior that Fillers may override. |
Mandate Method | A method that Fillers must provide. |
Helper Method | A method in the Skeleton that is used by the Template Method. |
Factory Method | A method that creates an object the precise type of which is determined by Fillers. |
Ah, so the Template Method defines the skeleton, and the subclasses put the meat on the bones...
(Reading...)
Formatting Hints:
To format... | use this markup: |
---|---|
source code | {source:lang=java|lineNumbers=false}...{source} (Supported languages: java, cpp, csharp, c, python.) |
bold text | __some text__ |
italicized text | ~~some text~~ |
underlined text | @@some text@@ |
a method or class name | ``myMethod(...)`` |