UML Diagrams
Use Cases
Derived from Scenarios and requirement specs
Class Relations
Interactions Diagrams
Sequence Diagrams
Collaboration Diagrams
The Cinema Booking System
The cinema booking system should store seat bookings for multiple theatres.
Each theatre has seats arranged in rows.
Customers can reserve seats and are given a row number and seat number.
They may request bookings of several adjoining seats.
Each booking is for a particular show (i.e., the screening of a given movie at a certain time).
Shows are at an assigned date and time, and scheduled in a theatre where they are screened.
Sample scenarios
1) A customer calls the cinema and wants to make a reservation for
two seats to watch Che Part Two tonight. The cinema employee starts using the booking system to find and reserve a seat
2) A customer requests five seats together. Work out exactly how five
adjoining seats are found
3) A customer with an existing reservation calls. She wants to reserve
another seat next to the ones she already has
4) A customer calls to cancel a reservation. He gives his name and the
name of the movie
5) A show is cancelled. The cinema wants to call all customers that
have reserved a seat for it.
6) Two new theatres have been added to the cinema. Theatre A has 26
rows with 18 seats each. Theatre B has 32 rows. In this theatre the first six rows have 20 seats, the next 10 rows have 22 seats and the other rows have 26 seats
7) A new movie is scheduled for screening. It will be screened for the
next two weeks, three times each day (4.40 pm, 6.30 pm and 8.30 pm). All shows run in theatre A
The Use Case Diagram
Reserve seats
Cancel seats Customer
Sets up new show
Cancel show Employee
Collaboration for reserving seats
aCustomer:TicketBuyer
reserve(theSeats)
theShow : Show
theTheatre : Theatre theRow : Row 1.1: reserve
1.1.1: reserve
1.1.1.1: okToReserve
1: reserve
Iteration on Sequence Diagrams
To record interactions occurring several times
“*” for several times
Iteration on Sequence Diagrams
abab
“a” twice
Every time
Another example
Sequence for reserving seats
aCustomer:TicketBuyer
reserve(theSeats)
theShow : Showing theScreen : Screen theRow : Row theSeat : Seat
1: reserve
1.1: reserve
1.1.1: *[i:=1..n] reserve
The Online Visit Planner
The aim is to build an online
application that can be used to
plan visits to popular attractions.
Such planner should allow users
to indicate which places of an
attraction map they would like to
visit and then come up with a
sensible route (using the nearest
neighbour algorithm, the
distances between places are
given in a distances table). This
route could be modified by the
user adding or deleting places to
visit and / or by indicating a
A scenario
Tom and his family are visiting
London Zoo on Sunday but haven’t
got much time to do it so he wants to
work out a sensible route beforehand.
Using the online planner he marks
the map locations of the different
animals they want to see. Then he
specifies that they want to start by
looking at the penguins and requests
a route. The system starts by
including the starting point as the
first node in the route and then
linking each node with the marked
place in the map closest to it.
UML Diagrams
CRC cards
Class relation diagrams
with multiplicity,
ownership and
navigability
Sequence diagram for
obtaining a route (given
a set of places and a
starting place)
Collaboration diagram
Class diagram
Online Visit Planner plans Route
Map contains 1 1..* Distance Table manages 1 1 Place 1 1..* consults 1 1 1 1..* displays 1..* 1 records distances
Sequence for obtaining route
aUser:VisitPlanner
getRoute()
theRoute : Route theMap : Map theTable :
DistanceTable thePlace : Place
1: getStartPlace() 2: getClosestNode() 2.1: getMarkedNode() 1.1: getFirstNode() *[i:=2..n] 3: includeNode(node) 3.1: setStatus(inRoute)
Collaboration for obtaining route
getRoute
theRoute : Route
theMap : Map thePlace : Place
2.1: getMarkedNode 1: getStartPlace theTable : DistanceTable aUser:VisitPlanner 2: getClosestNode 3: includeNode 3.1: setStatus
OOP design of your project
Create UML diagrams for the design of your
project
Use cases with documentation
Class relation diagram
A couple collaboration diagrams
A request from a user to play
A user’s response or move in the game