0% found this document useful (0 votes)
237 views

UML Use Case Diagrams

The document discusses using use case diagrams for requirements capture in object oriented analysis and design. It describes collecting requirements, use cases, actors, use case diagrams, scenarios, and relationships between use cases. Use case diagrams capture system functionality and roles of external actors through use cases and relationships.

Uploaded by

swetha_2010
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
237 views

UML Use Case Diagrams

The document discusses using use case diagrams for requirements capture in object oriented analysis and design. It describes collecting requirements, use cases, actors, use case diagrams, scenarios, and relationships between use cases. Use case diagrams capture system functionality and roles of external actors through use cases and relationships.

Uploaded by

swetha_2010
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 43

Requirements

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

Use Case Diagrams


Object Oriented Analysis and Design

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 Diagrams


Object Oriented Analysis and Design

Requirements Collection (contd.)


 A thorough and unambiguous understanding
of the requirements is vital to ensure that
everyone knows what they are doing and why.
 Must be reviewed, reviewed again and
reviewed yet again before the design and
implementation begins.
 Involves the participation of domain-experts to
ensure that the requirements have been
correctly understood.
 captures the “WHAT” of the problem-domain.

Use Case Diagrams


Object Oriented Analysis and Design

The UML Mechanism


 Use Case Diagrams
 Captures the problem-domain in terms of
functionality to be provided (Use Cases), and
the “roles” (Actors) for whom these functions
are performed.
 An abstraction of the problem-domain and a
vehicle to facilitate a clear, well-articulated and
unambiguous understanding of the problem-
domain.

Use Case Diagrams


Object Oriented Analysis and Design

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:

Use Case Diagrams


Object Oriented Analysis and Design

Finding Use Cases


 What functions does the system perform?
 What functions do the “actors” require?
 What input/output does the system need?

Use Case Diagrams


Object Oriented Analysis and Design

Use Case - Example


The Bookworm is a circulating library that lends books
and journals for a specified period of time. Books are
lent to members only. If available, the book is issued
immediately 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 the loss/damage. Alternatively, at
the end of the period, the borrower may renew the
issue.
Membership is accorded for a period of one year, at the
end of which the member has the option to renew his
membership.

Use Case Diagrams


Object Oriented Analysis and Design

Use Case - Example (contd.)


Use Cases:

ReserveBook IssueBook ReturnBook

CollectDues RenewIssue RnwMship

ViewCatalog

Use Case Diagrams


Object Oriented Analysis and Design

Purpose of Use Cases


 To capture functional requirements of a
system.
 To communicate with end users and domain
experts.
 To design test cases for validating system
functionality.
 To provide traceability from requirements
into actual classes and operations.
 To drive the development process.
 To plan iterations and releases

Use Case Diagrams 1


Object Oriented Analysis and Design

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?

Use Case Diagrams 1


Object Oriented Analysis and Design

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

Use Case Diagrams 1


Object Oriented Analysis and Design

Use Case Diagram


 A graphical representation of the Use Cases of a
system, its actors, and the interaction between
them.
 It depicts the system boundary.
 Diagram Model elements
 Actors
 Use cases
 Relationships
• between Actors and Use Cases
• between Use Cases themselves
Use Case Diagrams 1
Object Oriented Analysis and Design

Use Case Diagram: Example


IssueBook RegMembership

ReturnBook
CollectDues

Librarian Member
ReserveBook
RenewIssue

RnwMship

ViewCatalog

Use Case Diagrams 1


Object Oriented Analysis and Design

Use Case Description


 Is a text description of the use case functionality
in the user language and terminology
 No specific UML format
 Describes WHAT and not HOW
 Typically includes:
 Objectives of the use case
 How the use case is initiated
 The flow of events
 Alternate flow in the use case
 How the use case finishes with a value to the actor

Use Case Diagrams 1


Object Oriented Analysis and Design

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).

Use Case Diagrams 1


Object Oriented Analysis and Design

Use Case Description - Example


Use Case: ViewCatalog
Actors: Librarian, Member
Purpose: Browse the Catalog of books and journals
Overview: Allows the librarian or a member to browse
through the catalog of books. The catalog
contains details such as …..

Main flow of events:


The use case begins when either actor starts browsing for a book.
They can specify a specific book by Title, Author or Publisher. All
books satisfying the specified criteria are displayed to the user
(Librarian or Member).

Use Case Diagrams 1


Object Oriented Analysis and Design

Relationships between Use Cases


 Uses
 Extends

 “Extends” relationship : «extends»


 use case A extends use case B when use
case A is similar to use case B, but has
some additional functionality.
 extended use cases are typically used to
describe variations in the normal flow of
events described by a general use case

Use Case Diagrams 1


Object Oriented Analysis and Design

Relationships between Use Cases


 “Uses” relationship : «uses»
 use case A uses use case B when use
case B is a chunk of behavior that is
required across several use cases.
 common behavior in several use cases
can be factored out into a single use case
that is used by the other use cases

Use Case Diagrams 2


Object Oriented Analysis and Design

«extends» and «uses» : Example


«uses» Updt
IssueBook
Books-in-hand

«uses»
CollectDues
Librarian
ReturnBook

RenewIssue ReserveBook
BkReserved
«uses»
«extends»
«uses» Member
RnwMship
Permit Transaction
ChgsDue
«extends»

Use Case Diagrams 2


Object Oriented Analysis and Design

Use Cases and Scenarios


 A Use Case actually describes a set of
sequences [of actions].
 Each sequence represents one possible flow of
actions in using the system.
 Each sequence is called a Scenario.
 A Scenario is basically one instance of a use
case.
 a Scenario is to a Use Case, what an Object is
to a Class.

Use Case Diagrams 2


Object Oriented Analysis and Design

Steps in Use Case Modeling


 Establish the system boundary. Identify the actors that
use the system.
 For each actor, consider what functions the system
provides for each Actor.
 Represent each function as a Use case. Name the Use
Case with the name of the function.
 Connect the Actor to all Use Cases initiated by the
Actor.
 If the Use Case requires participation by other Actors,
connect these actors also to the Use Case.

Use Case Diagrams 2


Object Oriented Analysis and Design

Steps in Use Case Modeling


 Factor optional or exceptional behavior in a Use Case,
into a separate Use Case and connect this new Use
Case with the main Use Case by extends relationship.
 Analyze all Use Cases and identify common functions
across groups of Use Cases. Factor each such common
function into a separate Use Case and connect this
common Use Case with the other Use Cases that use it,
by uses relationship.

Use Case Diagrams 2


Object Oriented Analysis and Design

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.

Use Case Diagrams 2


Object Oriented Analysis and Design

6.Describe that basic course in the description


for the use case. Describe it in terms of what
the Actor does and the system does in
response. Use implementation-independent
terms.
7. When the basic course is described, consider
alternates courses of events and add those as
extending use-cases.
8.Extract common courses as "used" use-cases.

Repeat steps 2 - 7 for all other actors.

Use Case Diagrams 2


Object Oriented Analysis and Design

Use Case Realization


 The use case diagram is an external view of the
system
 A use case is realized in a collaboration
 A collaboration shows an internal
implementation- dependent solution of a use
case in terms of:
 classes/objects
 their relationships
 their interaction

Use Case Diagrams 2


Object Oriented Analysis and Design

Use Case Realization


A Collaboration
1: msg1
:ClassA :ClassB
Use Case A
2: msg2

:ClassC 3: msg3 :ClassD

Use Case A description <<implements>> <<implements>> <<implements>>


1. Step 1
2. Step 2 Class A Class B Class C
3. ...
Oper1() Oper2() Oper3()
... ... ...

Use Case Diagrams 2


Object Oriented Analysis and Design

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

Use Case Diagrams 2


Object Oriented Analysis and Design

Use-Cases: Points to Ponder


 If I have a Use-Case that is associated with more than
one actor such that each actor has a different interest in
the same Use-Case, how do I model it?
 Model it as just one Use-Case in the top-level Use-Case
Diagram. Also examine the functionality encapsulated in
the Use-Case to find out whether some common behavior
can be factored out.
 Is it necessary to explicitly associate an actor in a
specialization with the Use-Cases that the super-type is
associated with?
 No; the generalization hierarchy implies that the
specialized actor is also associated with those Use-Cases

Use Case Diagrams 3


Object Oriented Analysis and Design

Use-Cases: Points to Ponder


 Does every actor become a class?
 There is no such relationship. If some data/state of the
actor needs to be stored by the system, then the actor finds
expression as a class.
 Is there any mapping between a Use-Case and a class
or set of classes?
 There is no direct mapping that can be established.
However, associated with each Use-Case is a Sequence
Diagram and a Collaboration Diagram. These model the
classes and the interaction between them.

Use Case Diagrams 3


Object Oriented Analysis and Design

Use Case - Example


Indian Railways provides for advance reservation on all long-
distance travel. The passenger seeking reservation of berth or
seats should purchase the tickets from Railway Reservation
Offices or Authorized Travel Agency only. To make an advance
booking, the passenger is expected to fill in a prescribed
application form and submit it to the reservation counter with
the appropriate amount. Advanced Reservations are made up
to 60 days in advance for all trains, for all classes exclusive of
the day of departure of trains. An individual can book only up to
six passengers on one requisition form provided all passengers
are for the same destination and for the same train.

Use Case Diagrams 3


Object Oriented Analysis and Design

Use Case - Example (contd.)


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. All these
are handled by a Reservation Clerk.
The system will also have a web-interface where users can
register themselves and purchase tickets online. They can pay
either by using their online banking account or by credit card or
by VPP. Reservations made over the internet can only be
cancelled across the counter.
The system will also have a querying facility that allows users to
check train time-tables, fares and availability of tickets.

Use Case Diagrams 3


Object Oriented Analysis and Design

Use Case - Example (contd.)


Use Cases:

Make Cancel
Modify Class
Reservation Reservation

Query
Print Ticket Check Fare
Timetable

Register
as Member

Use Case Diagrams 3


Object Oriented Analysis and Design

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

Use Case Diagrams 3


Object Oriented Analysis and Design

Use Case Diagram: Example


Modify Class

Check Fare

Query
Reservation Timetable
Passenger
Clerk
Make
Reservation

Cancel Register
Print Ticket
Reservation as Member

Use Case Diagrams 3


Object Oriented Analysis and Design

«extend» and «include» : Example

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

Use Case Diagrams 3


Object Oriented Analysis and Design

Case on Video Store

Use Case Diagrams 3


Object Oriented Analysis and Design

Case on Contact Management

Use Case Diagrams 4


Object Oriented Analysis and Design

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.

Use Case Diagrams 4


Object Oriented Analysis and Design

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.

Use Case Diagrams 4


Object Oriented Analysis and Design

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.

Use Case Diagrams 4

You might also like