this pattern is used when an object change its behavior based on its internals state diffrent of strategy pattern and state pattern its that strategy there is no single state , diffrent behaviors represent by diffrent strategy objects.
a main class have some behavioral that the sub class have these too but not identical with eash other so every behavioral have interface and set of classes of that
- Context - main class that get object for action
- Strategy - the abstract class/interface that concreteStrategy classes implement it
- ConcreteStrategy - class that take action on request diffrently from another concretestate class
- Interface Strategy
Context |
---|
|
Strategy |
---|
|
ConcreteStrategyA |
---|
|
ConcreteStrategyB |
---|
|