[Previous] [Next]
Use the State design pattern for the following purposes:
- To alter an object's behavior at run time based on changes to its internal state.
- To avoid compound conditional constructs based on an object's state. Instead define distinct classes that represent the specific behavior at a given state.