State


Usage

  • Also known as: Objects for States
  • Alters an object's behavior when its state changes
  • The object will appear to change its class

Diagram

State

Participants

Context
  • Defines the interface of interest to clients
  • Maintains an instance of a ConcreteState subclass that defines the current state
State
  • Defines an interface for encapsulating the behavior associated with a particular state of the Context
ConcreteState
  • Each subclass implements a behavior associated with a state of Context
Resources URL: 
notes/design_patterns/resources
Sources URL: 
notes/design_patterns/sources

See Also