Skip to content

Commit c5d0030

Browse files
author
Dominik Liebler
committed
README in TemplateMethod
1 parent ea3e477 commit c5d0030

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

TemplateMethod/Journey.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,7 @@
33
namespace DesignPatterns\TemplateMethod;
44

55
/**
6-
* Template Method is a behavioral design pattern.
7-
*
8-
* Perhaps you have encountered it many times already. The idea is to let subclasses
9-
* of this abstract template "finish" the behavior of an algorithm.
10-
*
11-
* A.k.a the "Hollywood principle" : "" Don't call us, we call you. ""
12-
* This class is not called by subclasses but the inverse.
13-
* How ? With abstraction of course.
14-
*
15-
* In other words, this is a skeleton of algorithm, well-suited for framework
16-
* libraries. The user has just to implement one method and the superclass do
17-
* the job.
18-
*
19-
* It is an easy way to decouple concrete classes and reduce copy-paste,
20-
* that's why you'll find it everywhere.
6+
*
217
*/
228
abstract class Journey
239
{

TemplateMethod/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Template Method
2+
3+
## Purpose
4+
5+
Template Method is a behavioral design pattern.
6+
7+
Perhaps you have encountered it many times already. The idea is to let subclasses of this abstract template "finish" the behavior of an algorithm.
8+
9+
A.k.a the "Hollywood principle": "Don't call us, we call you." This class is not called by subclasses but the inverse.
10+
How? With abstraction of course.
11+
12+
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.
13+
14+
It is an easy way to decouple concrete classes and reduce copy-paste, that's why you'll find it everywhere.

0 commit comments

Comments
 (0)