Design a movie ticket booking system
HardConceptClassic LLD Problems
Answer
Model a service like BookMyShow where users browse movies by city, pick a show, select seats and pay. The critical requirement is that two users must never book the same seat.
- Core classes:
City,Cinema,Screen,Seatwith aSeatTypeenum,Movie,Show,ShowSeat(a seat's status for one show),Booking,PaymentandUser. - Seat holds: when a user selects seats, mark the
ShowSeatrecords as held with an expiry of a few minutes; confirm them when payment succeeds or release them on timeout. - Concurrency: take a hold with an atomic conditional update that changes the status only if the seat is still available, or use optimistic locking with a version column.
- Patterns: Strategy for pricing and payment methods, Observer for booking confirmations and notifications.
More in Classic LLD Problems
| # | Problem | Platform | Difficulty | Open | 1st1st Visit | 2nd2nd Visit | RevRevise |
|---|---|---|---|---|---|---|---|
| 1 | Design a parking lot system | Concept | Medium | Read the answer to Design a parking lot system | |||
| 2 | Design a vending machine | Concept | Medium | Read the answer to Design a vending machine | |||
| 3 | Design an elevator system | Concept | Hard | Read the answer to Design an elevator system | |||
| 4 | Design a movie ticket booking system | Concept | Hard | Read the answer to Design a movie ticket booking system |