Intent
Define a family of algorithms, encapsulate each one, and make them interchangeable.
Strategy lts algorithm vary independently from clients that use it.
Applicability
- when object should be configurable with algorithm to be used
- need to dynamically reconfigure
Structure
[to do: diagram with StrategyContext and Strategy]
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
Uses in JHotDraw