Use Case Diagrams: ©ian Sommerville 2004 Slide 1
Use Case Diagrams: ©ian Sommerville 2004 Slide 1
A patient calls the clinic to make an appointment
for a yearly checkup. The receptionist finds the
nearest empty time slot in the appointment book
and schedules the appointment for that time slot. "
We want to write a use case for this scenario.
Remember: A use case is a summary of
scenarios for a single task or goal.
Step 1 Identify the actors
As we read the scenario, define those people or
systems that are going to interact with the
scenario.
A patient calls the clinic to make an appointment for a yearly checkup.
The receptionist finds the nearest empty time slot in the appointment
book and schedules the appointment for that time slot. "
Who is interested in the scenario/system?
Where in the organization is the scenario/system be
used?
Who will benefit from the use of the
scenario/system?
Who will supply the scenario/system with this
information, use this information, and remove this
information?
Does one person play several different roles?
Do several people play the same role?
What other entity is interested in the
scenario/system?
What other entity will supply the scenario/system
with this information, use this information, and
remove this information?
Does the system use an external resource?
Does the system interact with a legacy system?
An Actor is outside or external the system.
It can be a:
• Human
• Peripheral device (hardware)
• External system or subsystem
• Time or time-based event
Represented by stick figure
A use case is a summary of scenarios for a
single task or goal.
An actor is who or what initiates the events
involved in the task of the use case. Actors
are simply roles that people or objects play.
So as we read our scenario, what or who is
the actor????
So as we read our scenario, what or who is
the actor????
A patient calls the clinic to make an appointment for a yearly
checkup. The receptionist finds the nearest empty time slot in the
appointment book and schedules the appointment for that time
slot. "
The actor is a Patient.
The use case is a summary of scenarios for a
single task or goal.
So What is the Use Case????
The Use Case is Make Appointment.
It is a use case for the medical clinic.
Actors are stick figures. Use cases are ovals. Communications are
lines that link actors to use cases.
©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 4 Slide
Slide 13
13
Use Case Componentss
The use case task referred to as the use case
that represents a feature needed in a software
system.
The actor(s) who trigger the use case to activate.
The communication line to show how the actors
communicate with the use case.
Make
Appointment
Make
Appointment
Make
Appointment
• Generalization
• Include
• Extend
a
©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 4 Slide
Slide 25
25
Use Case Diagram
Extend relationship
• Represents the extension of the use case
to include optional functionality
e
m
s
A
n Careful: Arrows between Use Cases are NOT data flows!
a
©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 4 Slide
Slide 29
29
93
U
0s Extend Relationship Between Use Cases
e3
5
C
a1
s
e
S
y
s
e
m
s
A
n Careful: Arrows between Use Cases are NOT data flows!
a
©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 4 Slide
Slide 30
30
30
15
- Includes and Extends
U
s
e
Includes
Extends
- • You have a piece of behavior • A use-case is similar to another
one but does a little bit more
C that is similar across many use
cases
a • Put the normal behavior in one
s • Break this out as a separate use-case and the exceptional
e use-case and let the other behavior somewhere else
ones “include” it • Capture the normal behavior
s • Try to figure out what can go wrong
in each step
• Examples include • Capture the exceptional cases in
• Valuation separate use-cases
• Validate user interaction
• Sanity check on sensor inputs • Makes it a lot easier to understand
• Check for proper authorization
Use cases are described using the language of the customer
(language of the domain which is defined in the glossary)
Use cases provide an easily-understood communication mechanism
When requirements are traced, they make it difficult for
requirements to fall through the cracks
Use cases provide a concise summary of what the system should
do at an abstract (low modification cost) level.
Reuse at the class level can be hindered by each developer “taking a
Use Case and running with it”. Since UCs do not talk about classes,
developers often wind up in a vacuum during object analysis, and can
often wind up doing things their own way, making reuse difficult
Use Cases make stating non-functional requirements difficult (where do
you say that X must execute at Y/sec?)
Testing functionality is straightforward, but unit testing the particular
implementations and non-functional requirements is not obvious
Each Use Case in the system appears in the Survey with a
short description of its main function.
• Participants:
• Domain Expert
• Architect
• Analyst/Designer (Use Case author)
• Testing Engineer