Modeling System Behavior with Use-
Cases
Objectives: System Behavior
⬥ Understand the concept of system behavior
and how to capture it in a model
⬥ Understand the benefits of use-case
modeling
⬥ Understand how to create, read, and
interpret use-case models
Where Are We?
⬥ Concepts in use-case modeling
⬥ Use-case diagram contents
⬥ Understanding use-case specifications
⬥ Creating activity diagrams
What Is System Behavior?
⬥ System behavior is how a system acts and
reacts.
▪It is the outwardly visible and testable activity of
a system
⬥ System behavior is captured in use cases.
▪Use cases describe the system, its
environment, and the relationship between the
system and its environment.
Business Event concept
• A stimulus that requires a system’s
response
• Delineated in time; stands on its own
Events affecting a Charge Account Processing System
that determine what system has to do – functions, 5
Event types
⬥ External Events
▪Caused by external agent (human, system)
⬥ Temporal Events
▪Occur when system reaches a point in time;
calendar time tracking in computer
⬥ State Events
▪Asynchronous events responding to a system
trigger (e.g., if QuantityOnHand=<ReorderAmount, create
purchasing order)
6
Events Table
Inpu Outp
t ut
Figure 5-10
7
What Is a Use-Case Model?
⬥ A model that describes a
system’s functional View Report Card
requirements in terms of
use cases
⬥ A model of the system’s Student
Register for Courses
intended functions (use
cases) and its
environment (actors) Login
What Are the Benefits of a Use-Case Model?
⬥ Used to communicate with the end users and
domain experts
▪ Provides buy-in at an early stage of system
development
▪ Insures a mutual understanding of the requirements
⬥ Used to identify
▪ Who interacts with the system and what the system
should do
▪ The interfaces the system should have
⬥ Used to verify
▪ All requirements have been captured
▪ The development team understands the requirements
Major Concepts in Use-Case Modeling
⬥ An actor represents anything
that interacts with the system.
⬥ A use case is a sequence of
actions a system performs
that yields an observable Actor
result of value to a particular
actor.
Use Case
Where Are We?
⬥ Concepts in use-case modeling
⬥ Use-case diagram contents
⬥ Understanding use-case specifications
What Is an Actor?
⬥ Actors are not part of the system.
⬥ Actors represent roles a user of
the system can play.
⬥ They can represent a human, a
machine, or another system.
⬥ They can actively interchange
information with the system.
⬥ They can be a giver of information.
⬥ They can be a passive recipient of
information.
Actor
Actors are
EXTERNAL.
Useful Questions in Finding Actors?
⬥ Who will supply, use, or remove
information?
⬥ Who will use this functionality?
⬥ Who is interested in a certain
requirement?
⬥ Where in the organization is the system
used?
⬥ Who will support and maintain the
system?
⬥ What are the system’s external Actor
resources?
⬥ What other systems will need to interact
with this one?
Focus on the Roles
⬥ An actor
represents a role
that a human,
hardware device,
or another system
can play.
?
Primary actors: actors who are going to
use the system directly
Secondary actors: They supervise and
maintain the system. Due to secondary
actors ,primary actors can use the system
Consider internet subscription as the system. The
actors involved as customer and the internet
service provider
Now identify the primary and secondary actors?
t
Primary actor: customer
Secondary actor: service provider
Now the service provider depends on
the customer. if the customer is not their,
service provider will not exist
UML Actor Notation and Generalisation Examples
«actor»
The guy
⇒
Staff The guy
Clerical staff Academic staff Support staff
Use Case – Example (generalize relationship): Actor-to-Actor
relationship
generalized
actor
Cook
specialize
d
actor
Mom Cook Father Cook
A User May Have Different Roles
Xyz as
studen
t
xyz
Student
xyz as
professor
Professor
Practice: Find the Actors
⬥ In the Course Registration System
Requirements document, read the Problem
Statement for the Course Registration case
study.
⬥ Identify the following
▪Actors
▪Description of the actor
Case Study: Course Registration Problem Statement
Course Registration Problem Statement
(From Visual Modelling with Rational Rose and UML, Terry Quatrani 1998)
The university will require a new Course Registration system. At the
beginning of each semester, professors at the university will register
the courses that they are going to teach with the system. The system
then will allow students to request a course catalogue containing a
list of course offerings for the coming semester. Information about
each course such as professor, department and prerequisites are
included. The student then can select four-course offering. Once the
registration process is completed for a student, the registration
system sends information to the billing system so the student can be
billed for the semester. For each semester, there is a period of time
that students can change their schedule through adding or dropping
courses. Professors must be able to access the system to indicate
which courses they will be teaching and to see which students signed
up for their course offerings.
Practice: Solution
A person who is
The external system
registered to take
responsible for
courses at the
student billing
Billing System Student University
The unabridged
A person who is catalog of all
teaching classes at courses offered by
the University the University
Course Catalog
Professor
The person who is
responsible for the
maintenance of the
Registrar course registration
system
UML Use-Cases (UCs not UC Diagrams UCDs)
Definition: "A set of sequences of actions a system
performs that yield an observable result of value to a
particular actor.“
Use-case characteristics:
● Always initiated by an actor (voluntarily or
● involuntarily);
● Must provide discernible value to an actor;
● Must form a complete conceptual function.
(conceptual completion is when the end observable value is produced)
What Is a Use Case?
⬥ A sequence of actions a system performs
that yields an observable result of value to
a particular actor
Use Case
How to Find Use Cases
⬥ Answer the following questions
to find use cases.
▪ For each actor you have identified,
what are the tasks the system
would be involved in?
▪ Does the actor need to be informed
about certain occurrences in the
system?
▪ Will the actor need to inform the
system about sudden, external
changes?
▪ What information must be modified
or created in the system?
Naming the Use Case
⬥ The name indicates what is
achieved by its interactions
with the actor(s).
Register ⬥ The name may be several
for words in length.
Courses ⬥ No two use cases should
have the same name.
Logi
n
Maintain
Student
Information
Practice: Solution
Register View Logi Select
for Report n Courses
Courses Card To Teach
Maintain Maintain Close
Submit Professor Student Registratio
Grade Informatio Informatio n
s n n
Use Cases and Actors
⬥ A use case models a dialog between actors
and the system.
⬥ A use case is initiated by an actor to invoke
a certain functionality in the system.
a use case:
. . .describes a sequence of actions,
performed by a system, that yields a
result of value to the user.
Use Cases and Actors
⬥ A use case models a dialog between actors
and the system.
⬥ A use case is initiated by an actor to invoke
a certain functionality in the system.
Actor Use Case
Communicates Association
Use Case Associations
⬥ A use case model consists of use cases and use case
associations
▪ A use case association is a relationship between use cases
⬥ Important types of use case associations: Include,
Extends, Generalization
⬥ Include
▪ A use case uses another use case (“functional decomposition”)
⬥ Extends
▪ A use case extends another use case
⬥ Generalization
▪ An abstract use case has different specializations
31
<<Include>> Relationship
▪An include relationship allows one use case to
use the functionality provided by another use case
▪Include relationships are typically used to model
some reusable functionality that is common to two
or more use cases
32
<<include>> Relationship
33
<<extend>> Relationship
An extend relationship allows one use case to
optionally extend the functionality provided by another
use case
34
Generalization Relationship
35
Generalization Relationship
•Example:
Consider the use case “ValidateUser”, responsible for
verifying the identity of the user.
The customer might require two realizations:
“CheckPassword” and “CheckFingerprint”
36
Difference b/w include & extend Relationship
⬥An include relationship suggests that one use
case always uses the functionality provided by
another
⬥In contrast an extends relationship allows one
use case to optionally extend the functionality
provided by another
37
Practice: Use Case and Actor Communication
⬥ In the Course Registrations System
Requirements document, read the Problem
Statement for the Course Registration case
study.
⬥ using the actors and use cases identified
earlier, identify:
▪Communicate-associations between the actors
and the use cases.
How Would You Read This Diagram?
View Report Card
Studen
t Maintain Professor
Register for
Course Information
Courses
Catalog
Logi
n
Maintain Student
Select Courses to Teach Information
Registra
Professo r
r
Submit Close Registration
Grades
Billing System
University Record System (URS)
⬥ A University record system should keep information about
its students and academic staff.
⬥ Records for all university members are to include their id
number, surname, given name, email, address, date of
birth, and telephone number.
▪ Students and academic staff each have their own unique ID
number: studN (students), acadN (academic employee), where N
is an integer (N>0).
⬥ In addition to the attributes mentioned above:
▪ Students will also have a list of subjects they are enrolled in. A
student cannot be enrolled in any more than 10 subjects.
▪ Academic employees will have a salary, and a list of subjects they
teach. An academic can teach no more than 3 subjects.
Some Actions Supported by URS
⬥ The system should be able to handle the
following commands.
▪ Add and remove university members
(students, and academic staff)
▪ Add and Delete subjects
▪ Assign and Un-assign subjects to students
▪ Assign and Un-assign subjects to academic
staff.
Use Case Diagram - URS System
URS
add member
del
syste member
m add academ
subject
user ic
del
subject
assg
subject
unass subject
enrol
subject
stude
unenrol
subject nt
Where Are We?
⬥ Concepts in use-case modeling
⬥ Use-case diagram contents
⬥ Understanding use-case specifications
⬥ Creating activity diagrams
Use-Case Specifications
⬥ Name Use-Case
⬥ Brief description Model
⬥ Flows of Events
⬥ Relationships
⬥ Activity and State
diagrams Actors
⬥ Use-Case diagrams Use Cases
⬥ Special
requirements
⬥ Pre-conditions
⬥ Post-conditions ...
⬥ Other diagrams
Use-Case Reports
Use-Case Flow of Events
⬥ Has one normal, basic flow
(“Happy Path”)
⬥ Several alternative flows
▪Regular variants
▪Odd cases
▪Exceptional flows handling error situations
“Happy Path”
What Are Scenarios?
⬥ A scenario is an instance of a use case.
Use Case Vs Scenarios
⬥ Each use case is one or more scenarios.
▪Add Subject Use Case :
• Scenario 1 : Subject gets added successfully.
• Scenario 2 : Adding the subject fails since the
subject is already in the database.
▪Enroll Subject Use Case:
• Scenario 1 : Student is enrolled for the
subject.
• Scenario 2 : Enrollment fails since the student
is already enrolled in the subject.
⬥ Each scenario has a sequence of steps.
Scenarios
⬥ Each scenario has a sequence of steps.
▪Scenario 1 : Student is enrolled for the subject.
• Student chooses the “enroll subject” action.
• Check the student has enrolled in less than
10 subjects.
• Check if the subject is valid.
• Assign the subject to the student.
Scenarios
⬥ Each scenario has a sequence of steps.
▪Scenario 2 : Enrolling fails since the student is
already enrolled in 10 subjects.
• Student chooses the “enroll subject” action.
• Check the student has enrolled in less than
10 subjects.
• Return an error message to the student.
Use Case Diagram for Student Assessment Management
System
Grade system
Recor
d
grade
s Stude
View nt
grades
Teache Distribute
r Report
cards
Create report
cards
Printing
administrator
Use Case Diagram – Example1 (Library)
library system
borro
w
clien employe
t reserv e
e
Order
title
Fine
payment
supervis
or
A Library
What Is an Activity State?
⬥ An activity state is an ongoing nonatomic
execution that
▪Can be decomposed.
▪May be interrupted and take some time to
complete.
⬥ An activity state represents the
performance of an activity or step within the
workflow.
Example: Activity Diagram
[ delete
Activity
Delete
Decisio course ] State
Course
n [ add
course ]
Select
Cours
e
Synchronization Bar Concurrent
(Fork) threads
Check Check
Schedule Pre-
requisites Transition
Guard Synchronization Bar
Condition (Join)
[ checks [ checks
completed ] failed ]
Assign to Resolve
cours conflict
e s
[ student added to the
course ]
Update
schedule
Swimlanes
Sales Fulfillment
Determine
Need
Take Order
Fill Order
Setup Payment
Deliver Order
Which Comes First?
OR
OR
Use-Case Specification Activity Diagram
⬥ It depends on how you prefer to work.
Checkpoints: System Behavior
⬥ Have you found all the use cases?
⬥ Do the use cases meet all the
functional requirements?
⬥ Does the use-case model contain any
superfluous behavior. That is, does it
present more functions than were
called for in the requirements?
⬥ By studying the use-case model, can
you form a clear idea of the system's
functions and how they are related?
Checkpoints: System Behavior (continued)
⬥ Have you found all the actors?
⬥ Is each actor involved with at least
one use case?
⬥ Can you name at least two people
who would be able to perform as a
particular actor?
⬥ Do any actors play similar roles in
relation to the system?
⬥ Will a particular actor use the system
in several different ways, or does he
have several completely different
purposes for using the use case?