UML Use Case Diagrams
UML Use Case Diagrams
Requirements Capture
Capture
using
using UML
UML Use
Use Cases
Cases
Object Oriented Analysis and Design
Contents
Requirements Collection
The UML Mechanism
Use Cases
Actors
Use Case Diagrams
Scenarios
Relationships between Use Cases
Requirements Collection
“Requirements” are the underlying principle of
any software development project.
Denotes the user-requirements; defines the
goals to be achieved.
Must be precisely and completely understood
by the team providing the solution.
User requirements (and team members) keep
changing; requirements must therefore be
well-documented.
Use Case
Is an abstraction of a set of sequences that
yield some functionality.
Represents some user-visible function.
Is always initiated by an “actor”.
Describes the interaction between the actors
and the system for a system function.
Achieves a discrete goal for the actor.
Notation:
ViewCatalog
Actors
Entities external to the system who interact with
the system.
Communicate with the system by sending
and/or receiving messages.
Represents a role, not individuals; can be a
person or a device or another system.
An actor may participate in many use cases; a
use case may have several actors participating
in it.
Notation:
Use Case Diagrams 1
Object Oriented Analysis and Design
Finding Actors
Who uses the main functionality of the system?
Who needs support from the system?
Who will need to maintain, administrate, and keep
the system working?
Which hardware devices the system needs to
handle?
Which other systems does the system need to
interact with?
Actors - Example
The Bookworm is a circulating library that lends books
for a specified period of time. Books are lent to
members only. If available, the book is issued forthwith
to the requesting member. If the book is not currently
available, the member can reserve the same. If the
member fails to return the book after the specified
period and/or loses or damages the book, he is required
to make good the loss/damage.
Actors:
Librarian Member
ReturnBook
CollectDues
Librarian Member
ReserveBook
RenewIssue
RnwMship
ViewCatalog
Flow of Events
Use Case is an abstraction of behaviour (set of
sequences).
The behaviour of the Use Case can be described
by a “flow of events” - which spells out in slight
detail what exactly the Use Case does.
Typically, flow of events specifies:
the main flow of events (what happens and in
what order when all is well).
alternate flow(s) of events (what happens and in
what order when something goes wrong).
«uses»
CollectDues
Librarian
ReturnBook
RenewIssue ReserveBook
BkReserved
«uses»
«extends»
«uses» Member
RnwMship
Permit Transaction
ChgsDue
«extends»
Alternative Steps
1. Identify who is going to be using the system
directly. These are the actors.
2. Pick one of those actors.
3. Define what that actor wants to do with the
system. Each thing that the actor does with
the system becomes a use-case.
4. For each use-case, decide on the most usual
course of events when that actor is using the
system.
Realization: Example
:UserInterface
1: parse(query)
2:optimize(postfix query)
:Parser :Optimiser
3: GenCode
(query tree)
Left Outer
:
Join Code
Generator
4: Execute(code)
:
:
Runtime
Database
Processor
Make Cancel
Modify Class
Reservation Reservation
Query
Print Ticket Check Fare
Timetable
Register
as Member
Actors - Example
Indian Railways wishes to develop a ticketing and
reservation system. This must support advance booking
of tickets, cancellation of tickets and change of class of
a ticket.
The system will also have a web-interface where users
can register themselves and purchase tickets online.
Actors:
Reservation Passenger
Clerk
Check Fare
Query
Reservation Timetable
Passenger
Clerk
Make
Reservation
Cancel Register
Print Ticket
Reservation as Member
Cancel Reservation
Reservation «include»
Clerk
Update
Seat Availability
«include»
Make Reservation
Factor out common
Passenger «extend» behaviour in a Use Case that
other Use Cases include.
Describe variations
from Normal Flow in a Generate Payment
extending Use Case Failure Notice
Use Case Diagrams 3
Object Oriented Analysis and Design
Case on Library
Summary
Requirements elicitation is the stepping stone
to the project.
Requirements must clearly and completely
understood by the entire project team.
Must be reviewed for semantic correctness
and completeness.
Requirements elicitation must focus on the
WHAT of the system and must be documented
in the user’s vocabulary.
Summary
Use Case Diagrams is the UML mechanism for
requirements capture.
Use Case Diagrams are a graphical presentation
of the “actors” in the domain and the “use cases”
initiated by them.
“Use cases” are abstractions of discrete
behaviour exhibited by the system; perform a
specific goal for an “actor”.
An “actor” is an abstraction of a role played by
anyone or anything interacting with the system.
Summary
A use case is essentially a set of sequence of
actions. A specific sequence of this set of
sequences is called a “scenario”.
A “scenario” is documented as “Flow of
Events”; each use case has a “main flow of
events” and “alternate flow of events”.
Common behaviour across use cases can be
factored out and is then either “used” or
“extended” by other use cases.