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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Applicability

A

An object’s behaviour is dependent on its state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Structure

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Context is the __________ for clients.

A

primary interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Related Patterns

A

Flyweight and State

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

__________ state-specific requests to the current ConcreteState object.

A

Context

How well did you know this?
1
Not at all
2
3
4
5
Perfectly