In the book 'Design Patterns Elements of Reusable Object-Oriented Software' of Erich Gamma et. al., you can read the following statement/ drawback of the strategy pattern:
And you can't vary the algorithm dynamically.
Book -> book page 317
But why should it be not possible to change the algorithm/ startegy at runtime??
In my context
I have a reference to a Startegy object, e.g., ConcreteStrategyA
. Therefore, I could exchange/ replace this object at runtime by an object class ConcreteSatrategyB
.
Aucun commentaire:
Enregistrer un commentaire