State Flashcards
1
Q
Intent
A
Allow an object to alter its behaviour when its internal state changes. It appears as if the object has changed its class
2
Q
Applicability
A
An object’s behaviour is dependent on its state.
3
Q
Structure
A
4
Q
Participants
A
- Context
- defines the interface of interest to clients
- maintains an instance of ConcreteState subclasses
- State
- defines an interface for encapsulating the behaviour associated with a particular state of the Context
- ConcreteState
- each subclass implements a behaviour associated with a state of the Context
5
Q
Collaboration
A
- Context delegates state-specific requests to the current ConcreteState object
- A context may pass itself as an argument to the State.
- Context is the primary interface for clients.
6
Q
Context is the __________ for clients.
A
primary interface
7
Q
Related Patterns
A
Flyweight and State
8
Q
__________ state-specific requests to the current ConcreteState object.
A
Context