• No results found

OO Design: UML Diagrams

N/A
N/A
Protected

Academic year: 2021

Share "OO Design: UML Diagrams"

Copied!
18
0
0

Loading.... (view fulltext now)

Full text

(1)
(2)

UML Diagrams

Use Cases

Derived from Scenarios and requirement specs

Class Relations

Interactions Diagrams

Sequence Diagrams

Collaboration Diagrams

(3)

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.

(4)

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

(5)

The Use Case Diagram

Reserve seats

Cancel seats Customer

Sets up new show

Cancel show Employee

(6)

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

(7)

Iteration on Sequence Diagrams

To record interactions occurring several times

“*” for several times

(8)

Iteration on Sequence Diagrams

abab

“a” twice

Every time

(9)

Another example

(10)

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

(11)

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

(12)

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.

(13)

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

(14)
(15)

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

(16)

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)

(17)

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

(18)

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

A couple sequence diagrams

A state diagram

References

Related documents

2 cups Sifted Flour: White Flour, Whole Wheat Pastry Flour or combination 1/2 cup Organic Sugar 1 teaspoon Salt 1/4 teaspoon Baking Soda 2 1/4 teaspoon Baking Powder 1/4 cup

If this vehicle is equipped with (factory) driver’s seat or front seats, -when completed, it will conform to MVSS 207 Seating Systems if no alterations are made to the seats, seat

[r]

P.13, as amended, from Council’s refusal or neglect to enact a proposed amendment to Zoning By-law 270-2004 of the City of Brampton to rezone lands located south of

The use of resin-modified glass-ionomer cement lining and the composite layering insertion technique of resin composite did not affect bond strength and gap formation at the

Launch Fathom and drag the case table icon from the shelf to the workspace. Click on the attribute <new>, type the heading Team, and press Enter. Similarly, create

The following report investigates about the satisfaction level of employees with current employee engagement with the help of a survey research method .After

[63] Yearly Houdini séances are also conducted in Chicago at the Excalibur nightclub by " necromancer " Neil Tobin on behalf of the Chicago As- sembly of the Society of