Skip to main content

Use Case Diagram

Editorial

Purpose of the Use Case Diagram

The use case diagram is our functional overview — it shows WHO interacts with the system and WHAT they can do. Before we dive into the structural details (class diagram) or runtime behavior (sequence diagram), we need to answer two questions:

  1. Who are the actors? — Which external entities interact with the booking system?
  2. What are the use cases? — What goals can each actor achieve?

For the Movie Ticket Booking System, the use case diagram reveals that three distinct actors exist — not just the obvious "Customer" and "Admin," but also a System Timer that automates seat-hold expiration. This third actor is easy to miss and critical for the design.

This diagram traces directly to our requirements: R1-R4 (Admin manages movies/theatres/shows), R5-R10 (Customer books tickets), and R6 (System Timer expires holds). The Actor-Use Case mapping will guide which classes need which methods.

Identifying Actors

An actor is any external entity that interacts with the system. Let's derive actors from our requirements:

Actor 1: Customer (Primary)

  • Derived from: R5, R6, R7, R8, R9, R13
  • Role: A registered user who searches for movies, selects seats, makes payment, and manages their bookings
  • Interacts via: Search, browse, select, pay, cancel
  • This is the primary actor — the system exists to serve customers

Actor 2: Admin

  • Derived from: R1, R2, R3, R4
  • Role: A theatre operator who manages movies, theatres, screens, shows, and seat configurations
  • Interacts via: Add/update/remove movies, configure screens, schedule shows
  • This is a supporting actor — they configure the system that customers use

Actor 3: System Timer (Automated)

  • Derived from: R6, R10
  • Role: An automated agent that monitors seat holds and expires them when the timeout period elapses
  • Interacts via: expireHold() — triggered by time, not by a human
  • This is easy to overlook but essential. Without the System Timer, held seats are never released if a user abandons checkout. In the code, this actor maps to a scheduled task or a timeout callback.

Why not a "Payment Gateway" actor?

You might consider the external payment service as an actor. In a full system design, it would be. But in our LLD scope, we model Payment as an internal class — the gateway integration is abstracted. We don't model the external callback from Stripe or PayPal. If the interviewer asks, mention it as an extension.

Identifying Use Cases

Each use case represents a goal that an actor achieves through the system. Let's group them by actor:

Customer Use Cases:

#Use CaseRequirementDescription
UC1Search MoviesR13Find movies by title, genre, language, or city
UC2Browse ShowsR3, R13View available showtimes for a selected movie
UC3View Seat MapR5See available/held/booked seats for a specific show
UC4Select SeatsR6Choose one or more available seats — triggers temporary hold
UC5Make PaymentR8Pay for the held seats — transitions booking to CONFIRMED
UC6View BookingsR7View current and past bookings
UC7Cancel BookingR9Cancel a CONFIRMED booking before the show starts

Admin Use Cases:

#Use CaseRequirementDescription
UC8Add/Update MovieR1Create or modify movie information
UC9Configure ScreenR2, R4Set up a screen's seating layout (rows, columns, seat types)
UC10Schedule ShowR3Assign a movie to a screen at a specific date and time

System Timer Use Cases:

#Use CaseRequirementDescription
UC11Expire Seat HoldsR6, R10Release seats when the hold timer elapses — transitions booking to EXPIRED

Include and Extend Relationships:

  • UC4 (Select Seats) includes UC3 (View Seat Map) — you always view before selecting
  • UC5 (Make Payment) includes a price calculation step driven by R11 (pricing strategy)
  • UC7 (Cancel Booking) extends UC6 (View Bookings) — cancellation is an optional action from the bookings view
  • UC11 (Expire Seat Holds) extends UC4 (Select Seats) — expiration only triggers if payment isn't completed in time

Run the Use Case Diagram

The diagram below is live. Set up tonight's show as the Admin, book seats as the Customer, and let the clock run for the System Timer: each use case lights up when its actor runs it, «include» fires every time, and each «extend» fires only when its condition holds.

Interactive: the Movie Ticket Booking use case diagram runs live. As the Admin, add a movie, configure Screen 1 and schedule a show (UC8 to UC10); as the Customer, search movies, browse showtimes, view the seat map, select and hold seats, pay, view bookings and cancel one (UC1 to UC7); the System Timer expires a hold that is not paid within 8 minutes (UC11). Select Seats includes View Seat Map, Cancel Booking extends View Bookings, and Expire Seat Holds extends Select Seats.

Complete Use Case Diagram

Complete UML use case diagram for the Movie Ticket Booking System showing Customer, Admin, and System Timer actors with 11 use cases and include/extend relationships

Key Design Decisions

1. Why is System Timer a separate actor?

The System Timer is not a human — it's a scheduled process that runs independently. But in UML, any external entity that triggers use cases is an actor. Without the System Timer, our use case diagram would not capture the critical hold-expiration behavior (R6). In the code, this maps to a scheduled task, a timer callback, or a periodic check — but from a use case perspective, it's an actor that triggers UC11.

2. Why didn't we model the Payment Gateway as an actor?

In our LLD scope, payment is handled by an internal Payment class. The external gateway (Stripe, Razorpay) is behind an abstraction. If we were doing system design, it would be an actor. In LLD, it's an implementation detail of Make Payment.

3. Why does Select Seats include View Seat Map?

A user cannot meaningfully select seats without first seeing which seats are available. The include relationship captures this mandatory dependency. In the code, selectSeats() will internally call the availability check that viewSeatMap() also uses.

4. Why 11 use cases (not fewer)?

A common mistake is collapsing use cases too aggressively — e.g., merging "Search Movies" and "Browse Shows" into "Find Movies." But these are distinct goals: searching by title is different from filtering by showtime. Keeping them separate ensures the class diagram has the right granularity.

5. How does this connect to the next diagrams?

The class diagram will provide classes for each use case. The sequence diagram will trace UC4 → UC5 (the booking flow) step by step. The state machine diagram will formalize the booking status transitions that UC4, UC5, UC7 and UC11 trigger. Each subsequent diagram zooms deeper into a specific dimension of this same system.