Skip to content

Latest commit

 

History

History

chapter10_state

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

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