State
Intent: Let an object alter its behaviour when its internal state changes.
When to use it
- Workflows with clear states
- Replacing large switch statements
Example
An invoice moving draft → sent → paid → void.
Intent: Let an object alter its behaviour when its internal state changes.
An invoice moving draft → sent → paid → void.