Extensible event ticketing system
I was asked this
No reports yet. Sign in to say where you were asked it.
An object-oriented design interview question asked in Amazon's technical phone screen, last asked Sep 2025. It tests object-oriented design and design patterns.
Design an EventTicketSystem that sells tickets for different kinds of events (concerts, movies, sports games). Adding a new kind of event or ticket later, with its own pricing rules, must not require changing existing code. Show the classes and interfaces, how a seat is held and bought, and how the design stays open to extension.
Requirements
- Functional: create events with their seats or inventory; list what is available; hold seats for a few minutes; purchase with idempotency so a retried request never charges twice; refund; pricing per ticket type through pluggable strategies (dynamic pricing, fees, discounts).
- Non-functional: no seat sold twice when many buyers want the same seats; a failed payment releases the hold; testable; easy to evolve.
Clarifying questions
- Reserved seats only, or also general admission with a capacity?
- How long does a hold last?
- Does pricing depend on time to the event, demand, or the buyer (student, member)?
- In-memory design only, or with persistence and APIs?
What a strong answer covers
- Classes:
Event(abstract, withConcert,Movie,SportsGame),VenueandSeat,Ticket,Hold,Order,PricingStrategy(interface;DynamicPricing,FlatFee,Discount, combinable as decorators), andEventTicketSystemas the façade. - Extension without edits: new event and ticket types registered with a factory or registry by type name, each bringing its pricing strategy, so the booking flow never branches on type.
- The booking flow: hold (seat status changes atomically from available to held, with an expiry), purchase (charge, then mark sold, keyed by an idempotency key), release on expiry or failure, refund as a new transaction.
- Concurrency: a conditional update or row lock per seat; a single-writer per event as an alternative; time-outs for holds.
- Persistence schema (events, seats, holds, orders, payments) and the main APIs (
POST /events/{id}/holds,POST /orderswith an idempotency key,POST /orders/{id}/refund). - Tests: unit tests per strategy, concurrency tests for seat contention.
Follow-ups
- Add a new event type, theatre, with seat tiers and early-bird pricing. Show what you add and what stays unchanged.
- A popular concert opens sales to 100,000 buyers at once. What changes?
- Payment succeeds but the response is lost. How do you make sure the buyer gets the ticket once?
Where it's asked
- Amazon · Technical phone screen · Last asked Sep 202560 min · Live coding in a shared editor that does not run code, plus Leadership Principles questions · No AI
What it tests
object-oriented design · design patterns
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
