Skip to content

Files

Latest commit

a503c81 · Sep 22, 2022

History

History

chapter10_state

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jul 1, 2021
Sep 22, 2022

readme.md

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