Why this matters
- Browse movies, showtimes, and seat maps per auditorium
- Scope — what "Seat map" covers inside Movie Ticket Booking and what it does not
- Scope — what "Hold timer" covers inside Movie Ticket Booking and what it does not
- Scope — what "Booking confirmation" covers inside Movie Ticket Booking and what it does not
- Booking problems test inventory, overlap, and concurrent holds.
BookingService
Resourceroom, seat, table
TimeSlotstart, end, capacity
Reservationstatus, userId
CampusOS context
CampusOS is the fictional smart-campus platform used across this track. Treat this module as a real product slice:
Context
- Belongs to CampusOS — same naming and design vocabulary as parking, library, and booking modules
- Scope is one JVM — persistence is in-memory or behind a repository interface
- Goal is a class diagram + core Java that an interviewer can follow in 35–45 minutes
- Extension paragraph at the end links to System Design when scale exceeds one process
Requirements snapshot
Functional requirements
- Browse movies, showtimes, and seat maps per auditorium
- Select seats; temporary hold expires if payment not completed
- Concurrent users cannot book the same seat — first confirm wins
- Payment confirms booking and issues ticket with QR code
- Cancel before showtime releases seats back to inventory
Non-functional requirements
- Seat hold must expire (e.g. 5 minutes) to prevent inventory lock
- Atomic seat confirmation under concurrent booking attempts
- Idempotent payment confirmation handler
Overview
This CampusOS module designs Movie Ticket Booking as a production-ready in-process service. Read requirements point-by-point before drawing classes.
Requirements
Points to cover
- Browse movies, showtimes, and seat maps per auditorium
- Select seats; temporary hold expires if payment not completed
- Concurrent users cannot book the same seat — first confirm wins
- Payment confirms booking and issues ticket with QR code
- Cancel before showtime releases seats back to inventory
Seat map
Points to cover
- Scope — what "Seat map" covers inside Movie Ticket Booking and what it does not
- Classes — name 2–4 classes/interfaces responsible for this slice
- Flow — step-by-step: trigger → validation → state change → side effect
- Edge cases — invalid input, concurrent access, empty state, timeout
- Pattern — Strategy, State, Observer, or Facade if it fits naturally
- Test hook — one scenario an interviewer will ask you to walk through
Hold timer
Points to cover
- Scope — what "Hold timer" covers inside Movie Ticket Booking and what it does not
- Classes — name 2–4 classes/interfaces responsible for this slice
- Flow — step-by-step: trigger → validation → state change → side effect
- Edge cases — invalid input, concurrent access, empty state, timeout
- Pattern — Strategy, State, Observer, or Facade if it fits naturally
- Test hook — one scenario an interviewer will ask you to walk through
Booking confirmation
Points to cover
- Scope — what "Booking confirmation" covers inside Movie Ticket Booking and what it does not
- Classes — name 2–4 classes/interfaces responsible for this slice
- Flow — step-by-step: trigger → validation → state change → side effect
- Edge cases — invalid input, concurrent access, empty state, timeout
- Pattern — Strategy, State, Observer, or Facade if it fits naturally
- Test hook — one scenario an interviewer will ask you to walk through
// CampusOS — MovieTicketBooking facade (keep thin)
public final class MovieTicketBookingService {
private final MovieTicketBookingRepository repository;
public MovieTicketBookingService(MovieTicketBookingRepository repository) {
this.repository = repository;
}
/** Orchestrate: validate → domain rules → persist → return result */
public Result handle(Request request) {
request.validate();
var domain = DomainModel.from(request);
domain.applyRules();
return repository.save(domain);
}
}
Quick recall
Everything you need if you only revisit this box.
- Requirements — review this slice before mock interviews.
- Seat map — review this slice before mock interviews.
- Hold timer — review this slice before mock interviews.
- Booking confirmation — review this slice before mock interviews.
CampusOS extension
When this outgrows one JVM
- Shard inventory or state by campus ID or geographic region
- Push notifications, payments, and search to dedicated services (System Design track)
- Use message queues for async side effects (email, analytics)
- The class diagram you drew here becomes one box on the HLD architecture diagram
Test yourself
Answer these before moving on — recall is what makes it stick.