Sn8_ Use Case Diagrams

36
L 11.1 Lecture 8 Use Case Diagrams Based on Chapter 6 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and Design Using UML, (3 rd Edition), McGraw Hill, 2006.

Transcript of Sn8_ Use Case Diagrams

Page 1: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 1/36

L 11.1

Lecture 8

Use Case DiagramsBased on Chapter 6 of Bennett,

McRobb and Farmer:

Object Oriented Systems Analysisand Design Using UML, (3 rd Edition),

McGraw Hill, 2006.

Page 2: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 2/36

L 11.2

Drawing Use Case Diagrams

PurposeD ocument the functionality of thesystem from the users¶ perspectiveD ocument the scope of the systemD ocument the interaction between theusers and the system using supportinguse case descriptions (behaviour specifications)

Page 3: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 3/36

L 11.3

Use Case DiagramsU se ca se diag r am s a re h elpful in th ree way s:

De ter min e fe at ures (requ ire m e nt s ) of th e s ys te m;Co mm u nicating with c lie nt s .

Ge n er ating tes t ca ses

Page 4: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 4/36

L 11.4

Not a t io n of Use Case Diagrams

S taff Contact

Change a clientcontact

System or subsystem boundary Actor

Use caseCommunicationassociation

Page 5: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 5/36

L 11.5

Not a t io n of Use Case DiagramsA ct ors

D rawn as stick people with a nameThe roles that people, other systems or

devices take when communicating with aparticular use case or use casesNot the same as job titles or people

People with one job title may play the roles

of several actors (e.g. lecturer can be acustomer or student)One actor may represent several job titles(e.g. member of a company)

Page 6: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 6/36

L 11.6

A ct ors

Actors are discovered by examining:Wh o directly uses t h e systemWh o is responsible for maintaining t h e system

External h ardware used by t h e systemOt h er systems t h at need to interact wit h t h e

system

Page 7: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 7/36

L 11.7

Not a t io n of Use Case Diagrams

U se Ca sesD rawn as ellipses with a name in or below

each ellipseD escribe a sequence of actions that thesystem performs to achieve an observableresult of value to an actor The name is usually an active verb and anoun phrase

Page 8: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 8/36

L 11.8

B asic Use-Case Symb ol sU se ca se ± subset of the overall systemfunctionality

Represented graphically by a horizontalellipse/oval shape with the name of the usecase appearing above, below, or inside theellipse.

A ct or ± anything that needs to interact withthe system to exchange information.

Could be a human, an organization,another information system, an externaldevice, or even time.

Page 9: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 9/36

L 11.9

U se Ca se No tati o n/Na rr ativ e

Title Name of the system

Actor

Use Case

Communication Association

S ystem Boundary Rectangular box encasing use cases ONLY

Use Case NameUse Case Name

Page 10: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 10/36

L 11.10

Not a t io n of Use Case Diagrams

Co mm u nicati o n A sso ciati o n sLine drawn between an actor and a use case

Can have arrow heads to show where thecommunication is initiated (arrow points awayfrom the initiator)Represent communication link between an

instance of the use case and an instance of the actor (e.g. which student enrols whichcourse)

Page 11: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 11/36

L 11.11

Not a t io n of Use Case Diagrams

S ub- S ys te m sD rawn as a rectangle around a group of use

cases that belong to the same sub-systemIn a CAS E tool , use cases for different sub-system are usually placed in separate usecase diagrams, and the rectangle isredundant

Page 12: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 12/36

L 11.12

Not a t io n of Use Case Diagrams

Depe nd e nci esExtends and Includes relationships between

use casesS hown as stereotyped (label) dependenciesS tereotypes are written as text strings inguillemets: «extends» and «includes»

Page 13: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 13/36

L 11.13

Not a t io n of Use Case DiagramsExtends (extension) RelationshipOne use case provides additi o na l

fu ncti o na lity that may be required in another use case

There may be multiple ways of extending ause case, which represent variations in theway that actors interact with the use caseExtension points show when the extension

occurs A condition can be placed next to thedependency arrow

Page 14: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 14/36

L 11.14

Use Case Extends Relationship

Extends Association ± w h en you h ave 1 use caset h at is similar to anot h er use case but does a bit more or is more specialized=subclassRelations h ip between t h e extension use case and t h e use case it is extending is called an extendsrelations h ip.Represented as an arrow h eaded line beginning at

t h e extension use case and point to t h e use caseit is extending.Eac h extends relations h ip line is labeled ³<<extends>>.´

Page 15: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 15/36

L 11.15

Use Case Extends RelationshipI n Fig below, t h e Generate W areh ouse PackingOrder use case extends or en h ance t h efunctionality of t h e Place New Member Order use case by capturing additional actions t h at

need to be performed in t h e generation of wareh ouse packing order

Parent

ChildChild/subclass

Page 16: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 16/36

L 11.16

<<ex te nd s>>

Used when you wish to show that a usecase provides additional functionality thatmay be required in another use case.

S ummary, extends association is foundwhen you add a bit more specialized , newuse case that extends some of the use casethat you have

Page 17: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 17/36

L 11.17

<< extends>>F ig ure belo w s h o ws use ca se Pr int Cam p aign

su mma r y ex te nd s Ch e ck Cam p aign B u dg e tMe an s that a p a r tic ul a r po int in th e Ch e ck

Cam p aign B u dg e t th e use can op tio na llyinv o ke th e be havi our of Pr int Cam p aignS u mma r y (e g : pr int ou t th e in for mati o n in thi s ca se)

Check Campaignbudget

Print Campaign

summary

<< extends>>

S uper class

sub class

Extension of use case

Page 18: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 18/36

L 11.18

<<EXTENDS>>

Class Registration

Registration for S pecial class

Prereq courses notcompleted

S tudent Billing

I nstructor

RegistrationClerk

Office

Student <<extends>> <<extends>>

Page 19: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 19/36

Page 20: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 20/36

L 11.20

CampaignManager

Check campaignbudget

summary

«extends»user requiresprint-out

Print campaign

S ummary print: systemdisplays balance

Exte n s io n po int s

Ex t ends Re la t io nship

Page 21: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 21/36

L 11.21

Not a t io n of Use Case Diagrams (8)Inc lu d es /U ses Rel ati o n s hi p

One use case a lway s includes thefu ncti o na lity of an o th er use ca se

A use case may include more than oneother Can be used to separate out a sequenceof behaviour that is used in many use

casesS hould n o t be used to create ahierarchical functional decomposition of the system

Page 22: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 22/36

L 11.22

M ember

Circulation

clerk

Library Information S ystem

Borrow books

Return books

Interlibrary loan

P urchase supplies

Check librarycard

<<uses>>

<<uses>>

<<uses>>

librarian

Page 23: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 23/36

L 11.23

Eg : C h ecking a library card is common amongborrow books, return book and interlibrary loan use cases

Summary, w h en you want to sh are commonsequences in several use cases, utilize useassociation by extracting common sequences

into a new, sh

ared use case

Page 24: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 24/36

Page 25: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 25/36

L 11.25

Figure above shows that use case Assignstaff to work on campaign has an<< include>> relationship with Findcampaign

It means that when Campaign Manager uses A ss ign s ta ff to wor k o n a cam p aignthe behavior of F ind Cam p aign will also beincluded in order to select the relevantcampaign

Page 26: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 26/36

L 11.26

<< US E S>>

Supplier

Track sales andInventory data

Reorder S upplies

Project ManagementReports

Manager

<<uses>>

<<uses>>

Generalized class

S pecialized class

Page 27: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 27/36

L 11.27

Wh en a Manager reorder supplies, t h e sales and inventory data are tracked Wh en management reports are produced, t h ere isanot h er uses relations h ip between t h e ProduceManagement Reports and Track Sales I nventory Data use caseTrack Sales and I nventory Data ± Generalized usecase represent t h e common be h avior among t h especialized use cases , Reorder Supplies and Produce Management Report T h us, w h en Reorder Supplies or ProduceManagement reports is performed, t h e entireTrack Sales and I nventory Data is used

Page 28: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 28/36

L 11.28

Not a t io n of Use Case Diagrams

Ge n er a lizati o nS hows that one use case provides a llthe functionality of the more specific usecase and some additional functionalityS hows that one actor can participate in

all the associations with use cases thatthe more specific actor can plus someadditional use cases

Page 29: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 29/36

L 11.29

S taff Contact

Record

completionof an advert

CampaignManager

Change aclient

contact

Assignindividual staff to work on a

campaign

Assign team of staff to work on

a campaign

Assign staff towork on acampaign

Page 30: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 30/36

Page 31: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 31/36

L 11.31

Use Case Descrip t io ns

Can be a step-by-step breakdown of interaction between actor and system

A ss ign s ta ff to w or k o n a cam p aign

A ct or A cti o n S ys te m R espo n se1 . The actor enters the client name. 2. Lists all campaigns for that client.3. S elects the relevant campaign. 4. D isplays a list of all staff members not already

allocated to this campaign.5. Highlights the staff members 6. Presents a message confirming

to be assigned to this campaign. that staff have been allocated.

A lter nativ e CoursesS teps 1± 3. The actor knows the campaign name and enters it directly.

Page 32: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 32/36

L 11.32

Use Case Descrip t io ns

Many projects use templatesname of use case

pre-conditionspost-conditionspurpose

descriptionalternative courseserrors

Page 33: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 33/36

L 11.33

Drawing Use Case Diagrams ±

st ep by s t ep1. Id e nti f y the actors and the use cases2. Pr ior itiz e the use cases

3. D evelop each use case, starting with thepriority ones, writing a description for each

4. Add structure to the use case model:generalization, include and extendrelationships and sub-systems

Page 34: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 34/36

L 11.34

Su mmary

In this lecture you have learned about:The purpose of use case diagrams

The notation of use case diagramsHow to draw use case diagramsHow to write use case descriptions

How prototyping can be used with use casemodelling

Page 35: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 35/36

Page 36: Sn8_ Use Case Diagrams

8/6/2019 Sn8_ Use Case Diagrams

http://slidepdf.com/reader/full/sn8-use-case-diagrams 36/36

L 11.36

Exercise A new shopping complex is open in your

locality. You have been asked to model aninformation kiosk for shoppers. Casualshoppers may use it to find out where aparticular named shop is, where they can buy

certain goods or what facilities are available.S hop renters in the complex can use thesame system to book function rooms, specialcleaning or security facilities . To use this, theymust enter a username and password . Whena new outlet is opened, or one changeshands, the complex manager updates the

information on the system