L04 UseCaseDiagram
L04 UseCaseDiagram
Requirements
Software
Requirement
Modeling with
Use-cases
1
Outline
• Introduction
• Use Case Diagrams
• Writing Use Cases
• Guidelines for Effective Use Cases
Where are we if in a project?
Phase Actions Outcome
Initiation & Raising a business need for a software Initial documents,
Feasibility Study project, Risk Analysis such as proposal
2.
2. Requirement
Requirement Analysis
Analysis
3.
3. Requirement
Requirement 4.
4. Requirement
Requirement
Documentation
Documentation Verification
Verification and
and Validatio
Validatio
• Design:
– How the
system should
do it
– More detailed
Use Cases – visualize functional
interactions
Register
User
admi
n Use Case Diagram Use Case Specification
Seller
A Seller represents a person who sells and delivers goods or services. The
Seller uses the system to look for new orders and to send order
confirmations, invoices, and payment reminders.
Accounting System
The Accounting System is responsible for keeping account balances.
The Accounting System needs the system to send it verified transactions.
13
11
A Use Case Diagram System
boundary
Finding Actors
• External objects that produce/consume data:
– Must serve as sources and destinations for data
– Must be external to the system
External
Humans Machines systems Sensors
Briefly describe the role each actor plays when interacting with
the system
14
Actors at Use Case Level
Secondary
User-centric.
Secondary
• Use case is Actor
Actor
Three Basic Types of Relationship
in Use Case Model
Inclusion
IF_Extension
Association 16
Association Relationship
• Association
– Instances of the actor and instances of
the use case communicate with each
other
17
<<Include>> Relationship
– Allow one to express commonality between
several different use cases.
18
More Example
• “place order” includes “validate
user”
19
Extend – Graphical
Representation
• The base use case can incorporate another use case at
certain points, called extension points. (IF… THEN… )
• Here means: In “Checkout” use case,
IF “the item is a gift”, THEN perform “Wrap
Gift”
21
Yet another relationship:
Generalization
• Generalization (Inheritance)
– A generalization from use case A to use case B
indicates that A inherits B.
Generalization
22
Actors can also be generalized
Example
Outline
• Introduction
• Use Case Diagrams
• Writing Use Cases
• Guidelines for Effective Use Cases
Structure of a Use Case
Specification
Name
Actors
Trigger
Preconditions
Post conditions
Success Scenario
Alistair Cockburn :
“Writing Effective Use Cases”
Alternatives flows
Contents in a single use case?
• Name: Give a short, descriptive name to the use case.
• Purpose: State clearly the purpose of the use case. Give a short
informal description.
• Actors: List the actors who can perform this use case.
• Pre-conditions: Describe the state of the system before the use
case.
• Flow of Events
– interactions between actors and the system
– business logic
• Not allowed paths (if any)
• Alternative paths (if any)
• Exceptions (if any)
• Post-conditions: State of the system in following completion.
• Extension Points
26
Triggers
• What Triggers/Starts the use-case?
• Examples:
– Customer reports a claim for refund
– Customer inserts bank card
– System clock is 10:00 (* Time is the Actor)
Pre-conditions
• What the system needs to be true
before running the use-case.
• Examples
– User account (must) exists
– If we want to operate on the account
– User (must) have enough money in her
account
– If we want to withdraw the amount requested
– There (must) be enough disk space
– If we want to write data to the disk drive
Alternate Courses: Step 2: [Extension point: If the club member has indicated an
address or telephone number change on the order, invoke
the use case Revise Street Address].
Step 3: If the product number is not valid, send a notification to the member
requesting the member to submit a valid product number.
Step 4: If the product being ordered is not available, record the ordered
product information and mark the order as “backordered.”
Step 6: If member’s credit card information is invalid or if member is found to
be in arrears, a credit problem notice is sent to the member. Modify the
order’s status to be “on hold pending payment.”
Precondition:
Orders can only be submitted by members.
Postcondition:
Member order has been recorded and the Packing Order has been routed to
the Warehouse.
Assumptions: None at this time.
39
Actor Description of an Invoice
System
Buyer
A Buyer represents a person who is responsible for buying goods or
services. This person may be an individual (i.e., not affiliated with a
company) or someone within a business organization. The Buyer of
goods and services needs the system to send orders and to pay
invoices.
Seller
A Seller represents a person who sells and delivers goods or
services. The Seller uses the system to look for new orders and to
send order confirmations, invoices, and payment reminders.
Accounting System
The Accounting System is responsible for keeping account
balances.
The Accounting System needs the system to send it verified
transactions.
40
Describe a Use Case:
“Pay Invoice” Use Case
41
Pay Invoice Use Case
Alternative Paths
In Step 2, the buyer may instead ask the system to send an invoice
rejection back to the seller.
Exceptions
In Step 3, if there is not enough money in the account, the use case
will cancel the payment and notify the buyer.
42
Use Case Specification
• A use case specification should
– Cover the Full sequence of steps from the
beginning of a task until the end.
– Describe the User’s interaction with the system ...
• Not the actual computations the system performs.
– As independent as possible from any particular
user interface design (i.e. it is not about design)
– Only include actions in which the actor interacts
with the system
43
What Makes Good Use-Case Specification?
45
Sample Use Case
Model From
Previous Students
46
Sample Use Case Model From Previous Students
47
Use-Case Name: View Game List
Actor(s): Primary: Member
This use case describes the event of viewing a list of games. The member
can view the games which are posted in this game web site. They can
Description:
input some keywords to search what games they want. They can also
spend their e-cash to buy what games they are interested in.
Reference ID: 6
The visitors must have previously logged on so that the system can
Precondition:
identify them as a member or not.
The use case is initiated when the members have logged in and then select
Trigger:
this option from the user interface.
Typical Course
Actor Action System Response
Of Events:
Step 1: This use case is initiated
Sample Use Case when the member has logged in
and selected the view game list
Specification From
option.
Step 2: The system responses by
displaying all the games to the member.
UC UC
More Guidelines
• Factor out common usages that are
required by multiple use cases
– If the usage is required use <<include>>
– If the base use case is complete and the usage
may be optional or conditional consider use
<<extend>>
• A use case diagram should:
– contain only use cases at the same level of
abstraction
– include only actors which are required
When? Are we done yet?
• When every actor is specified.
• When every functional requirement has a use-
case which satisfies it.
• A simple tractability matrix can help us
determine it:
Use Cases
Requirements
Use Case Summary
Introduction
To Use Case Diagram
Use Case Diagrams
Dual presentation of use-cases
Include, Extend, Inheritance
Writing Use Cases
Preconditions & Post-conditions
Main scenario vs. Alternative Flow
Guidelines for Effective Use Cases
Your Project
• Title/Topic done?
• What are the features/functional requirements?
• User stories, use case scenarios?
• Start working on the use cases of your project
• 1. Determine Actors (human, system) which are
external to the system
• 2. Use cases and system boundary (scope) ?
• 3. What are the interactions between them?
54