Key Concept for applying the Strategy Pattern:
-
At any given time only one algorithm is instantiated and active
-
The Strategy pattern encapsulates related classes that have different functionalities
-
The name of the message to the strategy object and the context object must be the same
-
None of the above
The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. The context object delegates work to a strategy object, and at runtime, only one strategy instance is active and being used. This allows the algorithm to vary independently from clients that use it. Option A correctly identifies that only one strategy is active at a time, the selected strategy. Option B incorrectly suggests the pattern encapsulates classes with different functionalities (it encapsulates interchangeable algorithms for the same task). Option C incorrectly imposes a naming constraint that isn't part of the pattern. Option D is incorrect since option A is valid.