Design Patterns - State

Allow an object to alter it’s behavior when it’s internal state changes. Each of this states is a different class, and this one is changed when needed, so the next behavior is given by the class that represents the state.

You need to decide who defines the state transition, either the context class that has the sate or every state class. This later one is more flexible, but needs access to the context class.

Notes References

20210408132546 Computer Science - Design patterns

References