Thumbnail for video 'TypeScript Design Patterns - State pattern'

← Back to courses

State pattern

The state pattern is used to keep track of the state of a process. In this video I'll use an order on Amazon.com as an example.

Each order moves to a specific process and the user has limited options at each state. For instance: you cannot cancel an order once it has been shipped. But you can cancel it at previous states.

Source code

Source code used in this video can be found on GitHub.