More than 3 years have passed since last update.

posted at

updated at

State Pattern

State Pattern

  • we create objects which represent various states and a context object whose behavior varies as its state object changes.
  • If we have to change the behavior of an object based on its state, we can have a state variable in the Object. Then use if-else condition block to perform different actions based on the state. State design pattern is used to provide a systematic and loosely coupled way to achieve this through Context and State implementations.


Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up