The state pattern isn't opinionated about how the state is orquestrated. We can implement it in three different ways:
- Orquestrated by the context: The context is responsible for changing the state.
- Orquestrated by the state: The states are responsible for changing the state to another state/next state.
- Orquestrated by client: The client is responsible for changing the state. The usualy pass the context as a parameter to the state.
- ✅ Clean code
- ✅ Single Responsibility Principle
- ✅ Open/Closed Principle
- ✅ Easy to add new states
- ❌ Overkill for simple cases (When there are only a few states)