Skip to main content

Case Study 1:- LOW LEVEL DESIGN OF ONLINE MOVIE TICKET BOOKING SYSTEM


Hello and welcome all to my LLD Case Study Series. Here I would try to express my learning’s of Object Oriented Design and Analysis which is perhaps also known as Low Level Design. It is a very important topic when you would be sitting for any Product Based Companies now or in future. So without further delay, let’s start.

Introduction:-

We are going to design the complete Movie ticket booking system using Object Oriented Analysis and Design (OOAD). First of all we would follow a series of steps in order to complete design the system from scratch. Those steps are discussed below.

1)      Requirement Gathering

2)      Creation of Use-Case Diagram

3)      Create Class Diagrams

4)      Coding the System

5)      Future Scopes



Requirement Gathering:-

So we would list some basic things that a movie ticket booking (or any ticket booking system) generally have. Those are:-
  •     The system would list current movies or shows.
  •     The system allows user to search for shows.
  •     The system would be listing different show timing for a movie.
  •     The system would allow the registered user to book a ticket as well as can see but an unregistered user can only see and browse movies.
  •     The system would allow the theatres to add and edit shows.
So these were some basic requirements that the system would contain. In the interview you can also ask to the interviewer that would the system contain other functionalities like Multi-Screens, Selection of Seats, Payment gateway, Multi-Lingual movies. These can be the future prospects one can consider. OK, now we can have the following assumptions.
  •     Every Theatre has some capacity.
  •     Every Theatre has single screen.
  •     Registered User can book tickets but unregistered user cannot book.
  •     Registered User can have the history of their bookings.
  •     Initially Movies are in two languages that is English and Hindi.
  •    Movies can have four genres: Action, Romance, Comedy and Horror.
  •    Initially let us keep it simple for now and excluding the Payment Gateway.
This was some requirements and assumptions that we made. Next on we would move onto create the use-case diagrams for our systems.

USE CASE DIAGRAMS:-

Ok now we are clear and ready with the requirements of the system, we can now move towards drawing the use-case diagram. So use-case diagram basically identifies the relationship between actors and the system. Through use-case diagrams we can get a much more clear insight on how the whole system would work. There are certain steps to make use-case diagrams. Those are:-
·         Identification of Actors(External Agents who would interact with our system)
·         Identification of Use-Cases
·         Adding Associations
·         Identification of Inclusive Use-Cases
·         Identification of External Use-Cases
·         Identification of Inheritances.
From the requirement analysis phase we have identified that we have two main or primary actors. Those are User and Theatre. So here is the basic use case diagram of our system.








This is the use-case diagram of our online Movie Ticket Booking System. I have considered BookMyShow as the system and user and theatre as the primary actors. Then we are denoting the use cases in our system. Register, login, Search movie, Book Ticket, Add Show, Update Show are the use cases shown in ovals. The straight lines from actors to use cases are known as Association (relations between the both). Then from Book a ticket we can identify an inclusive use-case known as Select Show(Payments can be another use case but we are not considering payment gateway here). Next step would be creating the Class Diagram of this system which would help us in better understanding and help in coding the system.



CLASS DIAGRAM:-

Below is the class diagram of the Online Movie Ticket Booking System.




So in this class diagram we have all classes that we have identified.
·         We have the Movie class with its respective Enums that are Genres and Languages (Genres and languages values would be constant throughout). They are in Aggregation with the Movie classes.
·         Main class is the BookMyShow class would be in a Composition Relation with Users and Theatre class. This is because the main component the app will contain is Users and Theatre lists.
·         There consists a Generalization Relationship between Registered User and Unregistered User with User class as the user class would be Abstract and two types of user class is separated so there is no need of creating objects of  User class.
·         There consists a One-to-Many Relation between Theatre Class and User Class as Theatre contains multiple shows.
·         Registered user can book tickets so there is a HAS-A relationship between Registered User and Ticket class. If you have ticket you can watch the Show, so there is also a HAS-A relationship between Ticket and Show class. Also Registered User class contains a One-To-Many relation to Show class as a person can book as many as shows.
Now we are good to go and let’s code the system.

CODING THE SYSTEM:-

For the code of the entire system in Object Oriented Manner you can go and check out my Github Repo where the code of this system is uploaded. Here is the link.
Github Repo:- https://github.com/Rajdp07/MovieTicketBookingSystem-LLD-OOAD


CONCLUSION:-

Coming to the very end of the interview you can be asked questions like:-

  • What would be further improvements that can be made?
  • What changes do we need to make to support Multi-screen theaters?
  • How will you handle concurrent seat selection in the app?
  • Suppose we want our app to support movies in 5 languages English, Hindi, Tamil, Gujarati, and Bengali. How do we achieve it in our current model?
  • How can we support location based search of theaters in our app?

Do some research about this questions and try to find out those answers. Until then stay tune to this series that I started to learn about more Low Level Design Interview Problems. If you are looking for a course on LLD then you can head over to GeeksforGeeks and buy their LLD course. Thanks again and see you soon.

 


Comments