Skip to content

Commit 06318d6

Browse files
author
Dominik Liebler
committed
README Strategy
1 parent c5d0030 commit 06318d6

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

Diff for: Strategy/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Strategy
2+
3+
## Terminology:
4+
5+
* Context
6+
* Strategy
7+
* Concrete Strategy
8+
9+
## Purpose
10+
11+
To separate strategies and to enable fast switching between them. Also this pattern is a good alternative to inheritance (instead of having an abstract class that is extended).
12+
13+
## Examples
14+
15+
* sorting a list of objects, one strategy by date, the other by id
16+
* simplify unit testing: e.g. switching between file and in-memory storage

Diff for: Strategy/index.php

-18
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,6 @@
22

33
namespace DesignPatterns\Strategy;
44

5-
/**
6-
* strategy pattern
7-
*
8-
* Terminology:
9-
* - Context
10-
* - Strategy
11-
* - Concrete Strategy
12-
*
13-
* Purpose:
14-
* to separate strategies and to enable fast switching between them.
15-
* also this pattern is a good alternative to inheritance (instead of having an abstract class that is extended)
16-
*
17-
* Examples:
18-
* - sorting a list of objects, one strategy by date, the other by id
19-
* - simplify unit testing: e.g. switching between file and in-memory storage
20-
*
21-
*/
22-
235
$elements = array(
246
array(
257
'id' => 2,

0 commit comments

Comments
 (0)