Strategy Flashcards

1
Q

Intent

A

Define a family of algorithms, encapsulating each one, and making them interchangable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

AKA

A

Policy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Related classes differ only in their _________

A

Behaviour

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

You require different variants of an _________

A

Algorithm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Structure

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Collaborations

A
  • Context forwards requests from its clients to Strategy
  • Client passes ConcreteStrategy object to the Context
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Related Patterns

A

Flyweight

How well did you know this?
1
Not at all
2
3
4
5
Perfectly