You are on page 1of 24

1

Using Use Case Diagrams


Using Use Case Diagrams

Use case diagrams are used to visualize, specify,


Use case diagrams are used to visualize, specify,
construct, and document the (intended) behavior
construct, and document the (intended) behavior
of the system, during requirements capture and
of the system, during requirements capture and
analysis.
analysis.

rovide a !ay for developers, domain e"perts and


rovide a !ay for developers, domain e"perts and
end#users to Communicate.
end#users to Communicate.

$erve as basis for testing.


$erve as basis for testing.

Use case diagrams contain use cases, actors, and


Use case diagrams contain use cases, actors, and
their relationships.
their relationships.


%
Use Case
Use Case

Use cases specify desired behavior.


Use cases specify desired behavior.

& use case is a description of a set of


& use case is a description of a set of
sequences of actions, including variants, a
sequences of actions, including variants, a
system performs to yield an observable
system performs to yield an observable
result of value to an actor.
result of value to an actor.

'ach sequence represent an interaction of


'ach sequence represent an interaction of
actors !ith the system.
actors !ith the system.
name


(
$pecifying the )ehavior of a Use Case
$pecifying the )ehavior of a Use Case

Describing the flo! of events !ithin the use case.


Describing the flo! of events !ithin the use case.

Can be done in natural language, formal language


Can be done in natural language, formal language
or pseudo#code.
or pseudo#code.

*ncludes+ ho! and !hen the use case starts and


*ncludes+ ho! and !hen the use case starts and
ends, !hen the use case interacts !ith actors and
ends, !hen the use case interacts !ith actors and
!hat ob-ects are e"changed, the basic flo! and
!hat ob-ects are e"changed, the basic flo! and
alternative flo!s of the behavior.
alternative flo!s of the behavior.


.
&ctors
&ctors

&n actor represents a set of roles that users


&n actor represents a set of roles that users
of use case play !hen interacting !ith these
of use case play !hen interacting !ith these
use cases.
use cases.

&ctors can be human or automated systems.


&ctors can be human or automated systems.

&ctors are entities !hich require help from


&ctors are entities !hich require help from
the system to perform their tas/ or are
the system to perform their tas/ or are
needed to e"ecute the system0s functions.
needed to e"ecute the system0s functions.

&ctors are not part of the system.


&ctors are not part of the system.
name


1
Use Cases and &ctors
Use Cases and &ctors

2rom the perspective of a given actor, a use


2rom the perspective of a given actor, a use
case does something that is of value to the
case does something that is of value to the
actor, such as calculate a result or change
actor, such as calculate a result or change
the state of an ob-ect.
the state of an ob-ect.

3he &ctors define the environments in


3he &ctors define the environments in
!hich the system lives
!hich the system lives


4
'"ample of Use Case Diagram
'"ample of Use Case Diagram
student
registration
updating
grades
output
generating
faculty


5
6elationships bet!een Use Cases
6elationships bet!een Use Cases
1. 7eneralization # use cases that are
1. 7eneralization # use cases that are
specialized versions of other use cases.
specialized versions of other use cases.
%. *nclude # use cases that are included as
%. *nclude # use cases that are included as
parts of other use cases. 'nable to factor
parts of other use cases. 'nable to factor
common behavior.
common behavior.
(. '"tend # use cases that e"tend the behavior
(. '"tend # use cases that e"tend the behavior
of other core use cases. 'nable to factor
of other core use cases. 'nable to factor
variants.
variants.


8
1. 7eneralization
1. 7eneralization

3he child use case inherits the


3he child use case inherits the
behavior and meaning of the
behavior and meaning of the
parent use case.
parent use case.

3he child may add to or


3he child may add to or
override the behavior of its parent.
override the behavior of its parent.
parent
child


9
registration
graduate
registration
non#graduate
registration
:ore about 7eneralization
:ore about 7eneralization


1;
%. *nclude
%. *nclude

3he base use case e"plicitly incorporates


3he base use case e"plicitly incorporates
the behavior of another use case at a
the behavior of another use case at a
location specified in the base.
location specified in the base.

3he included use case never stands alone. *t


3he included use case never stands alone. *t
only occurs as a part of some larger base
only occurs as a part of some larger base
that includes it.
that includes it.
base included
<<include==


11
:ore about *nclude
:ore about *nclude

'nables to avoid describing the same flo!


'nables to avoid describing the same flo!
of events several times by putting the
of events several times by putting the
common behavior in a use case of its o!n.
common behavior in a use case of its o!n.
updating
grades
output
generating
verifying
student id
<<include==
<<include==


1%
(. '"tend
(. '"tend

3he base use case implicitly incorporates


3he base use case implicitly incorporates
the behavior of another use case at certain
the behavior of another use case at certain
points called e"tension points.
points called e"tension points.

3he base use case may stand alone, but


3he base use case may stand alone, but
under certain conditions its behavior may
under certain conditions its behavior may
be e"tended by the behavior of another use
be e"tended by the behavior of another use
case.
case.
base e"tending
<<e"tend==


1(
:ore about '"tend
:ore about '"tend

'nables to model optional behavior or


'nables to model optional behavior or
branching under conditions.
branching under conditions.
'"am copy
request
'"am#grade
appeal
<<e"tend==


1.
6elationships bet!een &ctors
6elationships bet!een &ctors

7eneralization.
7eneralization.
student
non#graduate
student
graduate
student


11
6elationships bet!een Use Cases
6elationships bet!een Use Cases
and &ctors
and &ctors

&ctors may be connected to use cases by


&ctors may be connected to use cases by
associations, indicating that the actor and
associations, indicating that the actor and
the use case communicate !ith one another
the use case communicate !ith one another
using messages.
using messages.
updating
grades
faculty


14
'"ample
'"ample
place
phone call
cellular
net!or/
user
receive
phone call
place
conference
call
receive
additional
call
use
scheduler
<<e"tend==
<<e"tend==
Cellular 3elephone


15
Update Items
Bookshop
Worker
Ship Order
Bookshop
Manaer
Update Sta!! "etai#s
$eister "etai#s
%&stomer
'
S(stem )oin
Update %&stomer "etai#s
*dd Items to Shoppin%art
+and#e Order
,,in-#&de..
,,e/tend..
,,in-#&de..
Make Order
,,in-#&de..
& :ore Complicate '"ample
& :ore Complicate '"ample


18
'ach use case may include all or part of the follo!ing 'ach use case may include all or part of the follo!ing
:
:

3itle or 6eference >ame 3itle or 6eference >ame # meaningful name of the UC # meaningful name of the UC

&uthor?Date &uthor?Date # the author and creation date # the author and creation date

:odification?Date :odification?Date # last modification and its date # last modification and its date

urpose urpose # specifies the goal to be achieved # specifies the goal to be achieved

@vervie! @vervie! # short description of the processes # short description of the processes

Cross 6eferences Cross 6eferences # requirements references # requirements references

&ctors &ctors # agents participating # agents participating

re Conditions re Conditions # must be true to allo! e"ecution # must be true to allo! e"ecution

ost Conditions ost Conditions # !ill be set !hen completes normally # !ill be set !hen completes normally

>ormal flo! of events >ormal flo! of events # regular flo! of activities # regular flo! of activities

&lternative flo! of events &lternative flo! of events # other flo! of activities # other flo! of activities

'"ceptional flo! of events '"ceptional flo! of events # unusual situations # unusual situations

*mplementation issues *mplementation issues # foreseen implementation problems # foreseen implementation problems
Use Case Description
Use Case Description


19
'"ample# :oney Aithdra!
'"ample# :oney Aithdra!

Use Case+ Aithdra! :oney Use Case+ Aithdra! :oney

&uthor+ B) &uthor+ B)

Date+ 1#@C3#%;;. Date+ 1#@C3#%;;.

urpose+ 3o !ithdra! some cash from user0s ban/ account urpose+ 3o !ithdra! some cash from user0s ban/ account

@vervie!+ 3he use case starts !hen the customer inserts his credit @vervie!+ 3he use case starts !hen the customer inserts his credit
card into the system. 3he system requests the user *>. 3he system card into the system. 3he system requests the user *>. 3he system
validates the *>. *f the validation succeeded, the customer can choose validates the *>. *f the validation succeeded, the customer can choose
the !ithdra! operation else alternative 1 C validation failure is the !ithdra! operation else alternative 1 C validation failure is
e"ecuted. 3he customer enters the amount of cash to !ithdra!. 3he e"ecuted. 3he customer enters the amount of cash to !ithdra!. 3he
system chec/s the amount of cash in the user account, its credit limit. system chec/s the amount of cash in the user account, its credit limit.
*f the !ithdra! amount in the range bet!een the current amount D *f the !ithdra! amount in the range bet!een the current amount D
credit limit the system dispense the cash and prints a !ithdra! receipt, credit limit the system dispense the cash and prints a !ithdra! receipt,
else alternative % C amount e"ceeded is e"ecuted. else alternative % C amount e"ceeded is e"ecuted.

Cross 6eferences+ 61.1, 61.%, 65 Cross 6eferences+ 61.1, 61.%, 65




%;
'"ample# :oney Aithdra! (cont.)
'"ample# :oney Aithdra! (cont.)

&ctors+ Customer &ctors+ Customer

re Condition+ re Condition+
C
3he &3: must be in a state ready to accept transactions 3he &3: must be in a state ready to accept transactions
C
3he &3: must have at least some cash on hand that it can 3he &3: must have at least some cash on hand that it can
dispense dispense
C
3he &3: must have enough paper to print a receipt for at least 3he &3: must have enough paper to print a receipt for at least
one transaction one transaction

ost Condition+ ost Condition+


C
3he current amount of cash in the user account is the amount 3he current amount of cash in the user account is the amount
before the !ithdra! minus the !ithdra! amount before the !ithdra! minus the !ithdra! amount
C
& receipt !as printed on the !ithdra! amount & receipt !as printed on the !ithdra! amount
C
3he !ithdra! transaction !as audit in the $ystem log file 3he !ithdra! transaction !as audit in the $ystem log file


%1
'"ample# :oney Aithdra! (cont.)
'"ample# :oney Aithdra! (cont.)


Typical Course of events:
&ctor &ctions &ctor &ctions $ystem &ctions $ystem &ctions
1. )egins !hen a Customer arrives at &3: 1. )egins !hen a Customer arrives at &3:
%. Customer inserts a Credit card into &3: %. Customer inserts a Credit card into &3: (. $ystem verifies the customer *D and status (. $ystem verifies the customer *D and status
1. Customer chooses EAithdra!F operation 1. Customer chooses EAithdra!F operation .. $ystem as/s for an operation type .. $ystem as/s for an operation type
5. Customer enters the cash amount 5. Customer enters the cash amount 4. $ystem as/s for the !ithdra! amount 4. $ystem as/s for the !ithdra! amount
8. $ystem chec/s if !ithdra! amount is legal 8. $ystem chec/s if !ithdra! amount is legal
9. $ystem dispenses the cash 9. $ystem dispenses the cash
1;. $ystem deduces the !ithdra! amount from 1;. $ystem deduces the !ithdra! amount from
account account
11. $ystem prints a receipt 11. $ystem prints a receipt
1(. Customer ta/es the cash and the receipt 1(. Customer ta/es the cash and the receipt 1%. $ystem e-ects the cash card 1%. $ystem e-ects the cash card


%%
'"ample# :oney Aithdra! (cont.)
'"ample# :oney Aithdra! (cont.)

&lternative flo! of events+


&lternative flo! of events+
C
$tep (+ Customer authorization failed. Display an error $tep (+ Customer authorization failed. Display an error
message, cancel the transaction and e-ect the card. message, cancel the transaction and e-ect the card.
C
$tep 8+ Customer has insufficient funds in its account. $tep 8+ Customer has insufficient funds in its account.
Display an error message, and go to step 4. Display an error message, and go to step 4.
C
$tep 8+ Customer e"ceeds its legal amount. Display an $tep 8+ Customer e"ceeds its legal amount. Display an
error message, and go to step 4. error message, and go to step 4.

'"ceptional flo! of events+


'"ceptional flo! of events+
C
o!er failure in the process of the transaction before o!er failure in the process of the transaction before
step 9, cancel the transaction and e-ect the card step 9, cancel the transaction and e-ect the card


%(
'"ample# :oney Aithdra! (cont.)
'"ample# :oney Aithdra! (cont.)

@ne method to identify use cases is actor#based+ @ne method to identify use cases is actor#based+
# # *dentify the actors related to a system or organization. *dentify the actors related to a system or organization.
# 2or each actor, identify the processes they initiate or participate in. # 2or each actor, identify the processes they initiate or participate in.

& second method to identify use cases is event#based+ & second method to identify use cases is event#based+
# *dentify the e"ternal events that a system must respond to. # *dentify the e"ternal events that a system must respond to.
# 6elate the events to actors and use cases. # 6elate the events to actors and use cases.

3he follo!ing questions may be used to help identify the use cases for 3he follo!ing questions may be used to help identify the use cases for
a system+ a system+
#
Ahat are tas/s of each actor G Ahat are tas/s of each actor G
#
Aill any actor create, store, change, remove, or read information in the system G Aill any actor create, store, change, remove, or read information in the system G
#
Ahat use cases !ill create, store, change, remove, or read this information G Ahat use cases !ill create, store, change, remove, or read this information G
#
Aill any actor need to inform the system about sudden, e"ternal changes G Aill any actor need to inform the system about sudden, e"ternal changes G
#
Does any actor need to be informed about certain occurrences in the system G Does any actor need to be informed about certain occurrences in the system G
#
Can all functional requirements be performed by the use cases G Can all functional requirements be performed by the use cases G


%.
:oving on
:oving on

3he EthingsF that EliveF inside the system


3he EthingsF that EliveF inside the system
are responsible for carrying out the
are responsible for carrying out the
behavior the actors on the outside e"pect
behavior the actors on the outside e"pect
the system to provide.
the system to provide.

3o implement a use case, !e create a


3o implement a use case, !e create a
society of classes that !or/ together to
society of classes that !or/ together to
carry out the behavior of the use case.
carry out the behavior of the use case.

You might also like