Work on #226, #213, added references of Gang Of Four to all GoF patterns, added tag for Gang Of Four, added difficulty tags to some of them

This commit is contained in:
Narendra Pathai
2015-09-22 18:25:56 +05:30
parent dd0fcea090
commit b3e4e8a47b
23 changed files with 168 additions and 22 deletions

View File

@ -4,7 +4,10 @@ title: Template method
folder: template-method
permalink: /patterns/template-method/
categories: Behavioral
tags: Java
tags:
- Java
- Difficulty-Beginner
- Gang Of Four
---
**Intent:** Define the skeleton of an algorithm in an operation, deferring some
@ -18,3 +21,7 @@ an algorithm without changing the algorithm's structure.
* to implement the invariant parts of an algorithm once and leave it up to subclasses to implement the behavior that can vary
* when common behavior among subclasses should be factored and localized in a common class to avoid code duplication. This is good example of "refactoring to generalize" as described by Opdyke and Johnson. You first identify the differences in the existing code and then separate the differences into new operations. Finally, you replace the differing code with a template method that calls one of these new operations
* to control subclasses extensions. You can define a template method that calls "hook" operations at specific points, thereby permitting extensions only at those points
**Credits**
* [Design Patterns: Elements of Reusable Object-Oriented Software](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612)