Strategy (cont’d)
Consequences:
- a choice of implementations with different time and space tradeoffs
- context becomes free of implementation details
- details are delegated to strategies
- strategies encapsulate private data of algorithms
- increased number of objects
Implementation
- strategy-context data exchange: push vs. pull
Java
- Strategy is a candidate for an interface