Strategy Flashcards
1
Q
Intent
A
Define a family of algorithms, encapsulating each one, and making them interchangable.
2
Q
AKA
A
Policy
3
Q
Related classes differ only in their _________
A
Behaviour
4
Q
You require different variants of an _________
A
Algorithm
5
Q
Structure
A
6
Q
Participants
A
- Strategy
- declares an interface common to all supported algorithms
- Context uses this interface to call the algorithm defined by ConcreteStrategy
- ConcreteStrategy
- implements the algorithm using the Strategy interface
- Context
- is configured with a ConcreteStrategy object
- maintains a reference to a Strategy object
7
Q
Collaborations
A
- Context forwards requests from its clients to Strategy
- Client passes ConcreteStrategy object to the Context
8
Q
Related Patterns
A
Flyweight