Skip to the page

LLD problems · Design

Movie ticket booking with seat holds (BookMyShow)

The interviewer asks

Design the booking part of a movie ticket app like BookMyShow. A user picks a show, sees the seat map, selects seats, and the seats are held for them for a few minutes while they pay. If they pay, the booking is confirmed. If not, the seats are released. Walk me through the classes and the booking flow.

Then

Follow-ups the interviewer asks next

  1. Two users click the same seat at the same moment. What happens in your code?
  2. A user selects 4 seats and one of them is taken mid-way. All or nothing?
  3. The hold expires while the payment is still processing, and then payment succeeds. Now what?
  4. We run 10 app servers. Does your locking still work?
  5. Add a new seat type (recliner) and different prices per show time.
  6. How do you test the race?

The answer

What a strong answer covers

  • Classes: Movie, Cinema, Screen, Seat (row, number, type), Show (movie, screen, start time), ShowSeat (show, seat, status AVAILABLE/HELD/BOOKED, heldBy, holdExpiresAt, version), Booking (user, show, seats, status, amount), Payment; services ShowService, BookingService with holdSeats(user, show, seatIds), confirm(bookingId, paymentRef), release(bookingId).
  • The race: availability check and hold must be one atomic step. In memory: lock the requested ShowSeats in a fixed order (sorted ids), check all, hold all, unlock. With a database: one conditional update (… SET status = HELD WHERE id IN (…) AND status = AVAILABLE) and check the updated row count, or optimistic locking with a version, or a unique constraint on (show, seat) bookings.
  • All-or-nothing for multiple seats; on partial failure release what was taken.
  • Hold expiry: holdExpiresAt checked lazily on read plus a sweeper; an injected clock. Confirm checks that the hold is still theirs; if payment succeeded after expiry and the seat is gone, refund automatically.
  • Many servers: in-process locks no longer work; rely on the database's conditional update or a distributed lock with expiry (for example Redis SET key value NX EX).
  • Pricing as a strategy per seat type and show time; new seat types as data.
  • Idempotent confirm (a payment callback can arrive twice).

The red pen

Common traps

Avoid:synchronized on the whole booking method (correct but serialises every show in the country); check-then-book without atomicity; holds that never expire; "the database will handle it" with no mechanism named.

Practise this out loud

Say your answer out loud to an AI interviewer that follows up, and get a score for it.

Practise by voice

Practise questions like this out loud

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview