Use Case diagram-UML diagram-1

3,360 views 43 slides Apr 26, 2015
Slide 1
Slide 1 of 43
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43

About This Presentation

Descriptive slides for the Collaboration Diagrams in UML


Slide Content

Duration: 3 Hrs
1
RamakantSoni
Assistant Professor
Dept. of Computer Science
B K Birla Institute of Engineering & Technology, Pilani,
India
Ramakant Soni @ BKBIET Pilani

Usecasediagramsareusedtovisualize,
specify,construct,anddocument the
(intended)behaviorofthesystem,during
requirementscaptureandanalysis.
2
Provideawayfordevelopers,domainexperts
andend-userstoCommunicate.
Serveasbasisfortesting.
Usecasediagramscontainusecases,actors,
andtheirrelationships.
Ramakant Soni @ BKBIET Pilani

Usecasesspecifydesiredbehavior.
Ausecaseisadescriptionofasetof
name
3
Ausecaseisadescriptionofasetof
sequencesofactions,includingvariants,
asystemperformstoyieldanobservable
resultofvaluetoanactor.
Eachsequencerepresentaninteraction
ofactorswiththesystem.
Ramakant Soni @ BKBIET Pilani

Describingtheflowofeventswithintheuse
case.
Canbedoneinnaturallanguage,formal
4
Canbedoneinnaturallanguage,formal
languageorpseudo-code.
Includes:howandwhentheusecasestarts
andends;whentheusecaseinteractswith
actorsandwhatobjectsareexchanged;the
basicflowandalternativeflowsofthe
behavior.
Ramakant Soni @ BKBIET Pilani

Anactorrepresentsasetofrolesthatusers
ofusecaseplaywheninteractingwith
theseusecases.
Actorscanbehumanorautomated
name
5
Actorscanbehumanorautomated
systems.
Actorsareentitieswhichrequirehelpfrom
thesystemtoperformtheirtaskorare
neededtoexecutethesystem’sfunctions.
Actorsarenotpartofthesystem.
Ramakant Soni @ BKBIET Pilani

From the perspective of a given actor, a
use case does something that is of value
to the actor, such as calculate a result or
change the state of an object.
6
change the state of an object.
The Actors define the environments in
which the system lives
Ramakant Soni @ BKBIET Pilani

registration
7
student
updating
grades
output
generating
faculty
Ramakant Soni @ BKBIET Pilani

1.Generalization-usecasesthatare
specializedversionsofotherusecases.
2.Include-usecasesthatareincludedas
8
2.Include-usecasesthatareincludedas
partsofotherusecases.Enabletofactor
commonbehavior.
3.Extend-usecasesthatextendthe
behaviorofothercoreusecases.Enable
tofactorvariants.
Ramakant Soni @ BKBIET Pilani

The child use case inherits the
behavior and meaning of the
parent use case.
parent
9
parent use case.
The child may add to or
override the behavior of its parent.
child
Ramakant Soni @ BKBIET Pilani

registration
10
graduate
registration
non-graduate
registration
Ramakant Soni @ BKBIET Pilani

Thebaseusecaseexplicitlyincorporates
thebehaviorofanotherusecaseata
locationspecifiedinthebase.
base included
<<include>>
11
locationspecifiedinthebase.
Theincludedusecaseneverstands
alone.Itonlyoccursasapartofsome
largerbasethatincludesit.
Ramakant Soni @ BKBIET Pilani

Enables to avoid describing the same
flow of events several times by putting
the common behavior in a use case of
its own.
12
its own.
updating
grades
output
generating
verifying
student id
<<include>>
<<include>>
Ramakant Soni @ BKBIET Pilani

Ramakant Soni @ BKBIET Pilani 13

Thebaseusecaseimplicitlyincorporates
thebehaviorofanotherusecaseat
certainpointscalledextensionpoints.
base extending
<<extend>>
14
certainpointscalledextensionpoints.
Thebaseusecasemaystandalone,but
undercertainconditionsitsbehavior
maybeextendedbythebehaviorof
anotherusecase.
Ramakant Soni @ BKBIET Pilani

Enables to model optional behavior or
branching under conditions.
15
Exam copy
request
Exam-grade
appeal
<<extend>>
Ramakant Soni @ BKBIET Pilani

Ramakant Soni @ BKBIET Pilani 16

Generalization.
student
17
student
non-graduate
student
graduate
student
Ramakant Soni @ BKBIET Pilani

Actorsmaybeconnectedtousecases
byassociations,indicatingthattheactor
andtheusecasecommunicate with
oneanotherusingmessages.
18
oneanotherusingmessages.
updating
grades
faculty
Ramakant Soni @ BKBIET Pilani

place
phone call
cellular
place
conference
call
<<extend>>
19
cellular
network
user
receive
phone call
receive
additional
call
use
scheduler
<<extend>>
Cellular Telephone
Ramakant Soni @ BKBIET Pilani

20Ramakant Soni @ BKBIET Pilani

Each use case may include all or part of the following:
Title or Reference Name-meaningful name of the UC
Author/Date -the author and creation date
Modification/Date -last modification and its date
Purpose -specifies the goal to be achieved
Overview -short description of the processes
21
Overview -short description of the processes
Cross References -requirements references
Actors -agents participating
Pre Conditions -must be true to allow execution
Post Conditions -will be set when completes normally
Normal flow of events-regular flow of activities
Alternative flow of events -other flow of activities
Exceptional flow of events -unusual situations
Implementation issues-foreseen implementation problems

Use Case: Withdraw Money
Author: RS
Date: 19-Nov-2014
Purpose: To withdraw some cash from user’s bank account
Overview:Theusecasestartswhenthecustomerinsertshis
22
Overview:Theusecasestartswhenthecustomerinsertshis
creditcardintothesystem.ThesystemrequeststheuserPIN.The
systemvalidatesthePIN.Ifthevalidationsucceeded,the
customercanchoosethewithdrawoperationelsealternative1
–validationfailureisexecuted.Thecustomerenterstheamount
ofcashtowithdraw.Thesystemcheckstheamountofcashin
theuseraccount,itscreditlimit.Ifthewithdrawamountinthe
rangebetweenthecurrentamount+creditlimitthesystem
dispensethecashandprintsawithdrawreceipt,elsealternative
2–amountexceededisexecuted.
Cross References: R1.1, R1.2, R7
Ramakant Soni @ BKBIET Pilani

Actors: Customer
Pre Condition:
›The ATM must be in a state ready to accept transactions
›The ATM must have at least some cash on hand that it can
dispense
›The ATM must have enough paper to print a receipt for at
23
›The ATM must have enough paper to print a receipt for at
least one transaction
Post Condition:
›The current amount of cash in the user account is the
amount before the withdraw minus the withdraw amount
›A receipt was printed on the withdraw amount
›The withdraw transaction was audit in the System log file
Ramakant Soni @ BKBIET Pilani

Typical Course of events:
Actor Actions System Actions
1. Begins when a Customer arrives at ATM
2. Customer inserts a Credit card into ATM3. System verifies the customer ID and status
5. Customer chooses “Withdraw” operation4. System asks for an operation type
24
5. Customer chooses “Withdraw” operation4. System asks for an operation type
7. Customer enters the cash amount 6. System asks for the withdraw amount
8. System checks if withdraw amount is legal
9. System dispenses the cash
10. System deduces the withdraw amount from
account
11. System prints a receipt
13. Customer takes the cash and the receipt12. System ejects the cash card
RamakantSoni@ BKBIET Pilani

Alternative flow of events:
›Step 3:Customer authorization failed. Display an
error message, cancel the transaction and eject the
card.
›Step 8:Customer has insufficient funds in its account.
25
›Step 8:Customer has insufficient funds in its account.
Display an error message, and go to step 6.
›Step 8:Customer exceeds its legal amount. Display
an error message, and go to step 6.
Exceptional flow of events:
›Power failure in the process of the transaction before
step 9, cancel the transaction and eject the card
Ramakant Soni @ BKBIET Pilani

One method to identify use cases is actor-based:
-Identify the actors related to a system or organization.
-For each actor,identify the processes they initiate or participate in.
A second method to identify use cases is event-based:
-Identify the external events that a system must respond to.
-Relate the events to actors and use cases.
The following questions may be used to help identify the use
26
The following questions may be used to help identify the use
cases for a system:
-What are tasks of each actor ?
-Will any actor create, store, change, remove, or read information in the
system ?
-What use cases will create, store, change, remove, or read this
information ?
-Will any actor need to inform the system about sudden, external changes
?
-Does any actor need to be informed about certain occurrences in the
system ?
-Can all functional requirements be performed by the use cases ?
Ramakant Soni @ BKBIET Pilani

The“things”that“live”insidethesystem
areresponsibleforcarryingoutthe
behaviortheactorsontheoutside
expectthesystemtoprovide.
27
expectthesystemtoprovide.
Toimplementausecase,wecreatea
societyofclassesthatworktogetherto
carryoutthebehavioroftheusecase.
Ramakant Soni @ BKBIET Pilani

Ramakant Soni @ BKBIET Pilani 28

Controller
Water Pump
Hot Water
Water Valve
Home
Temp Sensor
*
29
Fuel Valve
90
80
70
60
50
On
Off
Burner
Fuel
Temp Sensor
Control Panel
Ramakant Soni @ BKBIET Pilani

Power Up
Home Heating
Home Owner
MH
Power Down
Change Temp.
30Ramakant Soni @ BKBIET Pilani

Use case: Power Up
Actors: Home Owner (initiator)
Type: Primary and essential
Description: The Home Owner turns the power on. Each room is temperature
checked. If a room is below the thedesired temperature the valve for
the room is opened, the water pump started. If the water temp falls the room is opened, the water pump started. If the water temp falls
below threshold, the fuel valve is opened, and the burner ignited. If the
temperature in all rooms is above the desired temperature, no actions
are taken.
Cross Ref.: Requirements XX, YY, and ZZ
Use-Cases: None
31Ramakant Soni @ BKBIET Pilani

Power Up
Power Down
Home Heating
Adjust Temp
Temp. High
«includes»
«includes»
Home Owner
MH
Change Temp.
Adjust Temp
Temp. Low
«includes»
«includes»
32Ramakant Soni @ BKBIET Pilani

Use case : Power Up
Actors : Home Owner (initiator)
Type : Primary and essential
Description : The Home Owner turns the power on.
Perform Adjust Temp. If the temperature in all rooms is
above the desired temperature, no actions are taken.
*
above the desired temperature, no actions are taken.
Cross Ref : Requirements XX, YY, and ZZ
Use-Cases : Perform Adjust Temp
33Ramakant Soni @ BKBIET Pilani

Ramakant Soni @ BKBIET Pilani 34
Credits : Scott W. Amber

Ramakant Soni @ BKBIET Pilani 35
Credits : Scott W. Amber

Example: Online shopping.
Ramakant Soni @ BKBIET Pilani 36
1.Place Your Primary Actor(S) In The Top-Left Corner Of The Diagram
2.Draw Actors To The Outside Of A Use Case Diagram
3.Name Actors With Singular, Business-Relevant Nouns
4.Associate Each Actor With One Or More Use Cases
5.Actors Model Roles, Not Positions
6.Use <<system>> to Indicate System Actors
7.Actors Don’t Interact With One Another
8.Introduce an Actor Called "Time" to Initiate Scheduled Events

Relationships
There are several types of relationships that may appear on a use case diagram:
•An association between an actor and a use case
•An association between two use cases
•A generalization between two actors
•A generalization between two use cases
Ramakant Soni @ BKBIET Pilani 37
Enrolling students in a university

Alibrarylendsbookstoborrowers,whoareregisteredina
membershipfile.Aborrowercanreserveabookthatisnot
currentlyavailableinthelibrary.Inafileofbookstheloaning
orreservationofabookwillbekeptuptodate.Thelibrarian
isanemployeeofthelibrarywhointeractswiththe
customers(borrowers).
Ramakant Soni @ BKBIET Pilani 38
oDesignasimplelibrarysystemforborrowingandreturning
books.Thefileofbooksandthemembershipfilemaybe
consideredasactors.
oDescribeoneusecasebymeansofausecasetext.

Proposeausecasediagramforan
ATMmachineforwithdrawingcash.
Make theusecasesimpleyet
informative;onlyincludethemajor
features.
Ramakant Soni @ BKBIET Pilani 39
features.

Ramakant Soni @ BKBIET Pilani 40

Proposeausecasediagramfora
vendingmachinethatsellsbeverages
andsnacks.Makeuseofinclusionand
extension associations, mark
multiplicitiesandremember thata
Ramakant Soni @ BKBIET Pilani 41
multiplicitiesandremember thata
vendingmachinemayneedtechnical
assistancefromtimetotime.

Ramakant Soni @ BKBIET Pilani 42

References:
[1] http://www.uml-diagrams.org/
[2] http://www.wikipedia.com/UML%diagrams
Ramakant Soni @ BKBIET Pilani 4343