README Strategy

This commit is contained in:
Dominik Liebler
2013-09-24 13:05:47 +02:00
parent c5d0030f5f
commit 06318d6220
2 changed files with 16 additions and 18 deletions

View File

@@ -2,24 +2,6 @@
namespace DesignPatterns\Strategy;
/**
* strategy pattern
*
* Terminology:
* - Context
* - Strategy
* - Concrete Strategy
*
* Purpose:
* 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)
*
* Examples:
* - sorting a list of objects, one strategy by date, the other by id
* - simplify unit testing: e.g. switching between file and in-memory storage
*
*/
$elements = array(
array(
'id' => 2,