4.9 State

The state pattern is very useful when your classes need to change their functionality based on their current state. Instead of using if...else blocks everywhere in your code, you can use the state pattern to extract these states into their own classes so you can transition between them very simply.