Architecture & LLD Preview
ATM Machine
Model an ATM as a state machine — idle, card inserted, authenticated, transaction, dispensing. Actions are only legal in the right state.
The GoF State pattern: one class per mode (Idle, HasCard, Authenticated), the ATM context delegates every action, and illegal actions reject themselves.
Core Design Challenge
"Design an ATM where the same action means different things per mode. How do you avoid an if-else swamp?"
What You'll Learn:
- ✦Modeling system states and transition triggers
- ✦Encapsulating state machines into design patterns
- ✦Handling concurrency, thread-safety, and transaction isolation
- ✦Managing invalid actions and edge cases cleanly in code