A Movie Ticket Booking System is a software application that enables users to search for movies, view showtimes, select seats, and book tickets at cinemas or multiplexes.
In this chapter, we will explore the low-level design of a movie ticket booking system in detail.
Let's start by clarifying the requirements:
Before starting the design, it's important to ask thoughtful questions to uncover hidden assumptions and better define the scope of the system.
Here is an example of how a conversation between the candidate and the interviewer might unfold:
Candidate: Is this system for the end-user (customer) to book tickets, or is it an internal system for cinema administrators to manage shows and screens?
Interviewer: Let's focus on the customer-facing booking workflow. The primary user story is a customer finding a movie and booking seats for a specific show.
Candidate: How should users find movies? Should they be able to search by movie title, city, or cinema?
Interviewer: Users should be able to find all shows for a specific movie in a given city.
Candidate: Should the system support different seat types such as ‘Standard’, ‘Premium’, and ‘Recliner’, with variable pricing?
Interviewer: Yes, each screen can have multiple seat types with different pricing.
Candidate: Should users be able to select specific seats, or should the system assign them automatically?
Interviewer: Users must be able to select specific seats from a seat map during the booking process.
Candidate: A critical issue in booking systems is concurrency. What should happen if two users try to book the same seat at the same time?
Interviewer: Excellent point. The system must prevent double-booking. When a user selects seats, those seats should be temporarily locked for a short duration while they complete the payment. If the payment is not completed within the timeout, the seats should be released.
Candidate: How is payment handled? Do we need to integrate with a real payment gateway?
Interviewer: We can assume an external payment gateway. Our system should be able to initiate a payment process with a specific amount and handle success or failure responses. The design should allow for different payment methods, like credit cards or PayPal.
Candidate: Should there be a notification feature? For example, notifying users when booking opens for a new, highly anticipated movie.
Interviewer: Yes, that's a great feature to include. Let's add a mechanism for users to subscribe to a movie and receive a notification when it becomes available for booking.
After gathering the details, we can summarize the key system requirements.
After the requirements are clear, lets identify the core entities/objects we will have in our system.