README in TemplateMethod

This commit is contained in:
Dominik Liebler 2013-09-24 13:03:40 +02:00
parent ea3e477a74
commit c5d0030f5f
2 changed files with 15 additions and 15 deletions

View File

@ -3,21 +3,7 @@
namespace DesignPatterns\TemplateMethod;
/**
* Template Method is a behavioral design pattern.
*
* Perhaps you have encountered it many times already. The idea is to let subclasses
* of this abstract template "finish" the behavior of an algorithm.
*
* A.k.a the "Hollywood principle" : "" Don't call us, we call you. ""
* This class is not called by subclasses but the inverse.
* How ? With abstraction of course.
*
* In other words, this is a skeleton of algorithm, well-suited for framework
* libraries. The user has just to implement one method and the superclass do
* the job.
*
* It is an easy way to decouple concrete classes and reduce copy-paste,
* that's why you'll find it everywhere.
*
*/
abstract class Journey
{

14
TemplateMethod/README.md Normal file
View File

@ -0,0 +1,14 @@
# Template Method
## Purpose
Template Method is a behavioral design pattern.
Perhaps you have encountered it many times already. The idea is to let subclasses of this abstract template "finish" the behavior of an algorithm.
A.k.a the "Hollywood principle": "Don't call us, we call you." This class is not called by subclasses but the inverse.
How? With abstraction of course.
In other words, this is a skeleton of algorithm, well-suited for framework libraries. The user has just to implement one method and the superclass do the job.
It is an easy way to decouple concrete classes and reduce copy-paste, that's why you'll find it everywhere.