# State: What You Can Do Depends on Where It Is

When every method of a package starts by checking its status, a new status means editing every method, and the one you miss breaks a rule; drawing the rules as a state diagram, then giving each status its own class, puts each status's rules in one place: the State pattern.

![Cheat sheet: State: What You Can Do Depends on Where It Is](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/1343ee8489944f9483e589866d94df96.webp)

- Category: Data Structures
- Level: Journeyman
- Tags: Code Smell, OOP, State Diagram, State Pattern
- Author: Gregor Dzierzon
- Updated: November 17, 2026

Source: https://www.ask-codey.com/cheat-sheets/dp-state-cheat-sheet
