Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 528 Bytes

File metadata and controls

13 lines (9 loc) · 528 Bytes

Chapter 10: State design pattern

State Pattern: allows an object to alter its behaviour when its internal state changes.

The class structure is the same as the Strategy Design Pattern but the intent is different : In the State pattern the subclasses represent specific application states and may cover multiple attributes and methods whereas Strategy allows an algorithm to be selected upon arbitrary criteria and would typically just apply to a single method.

Running the code

python gumballstate.py