Use Case Modeling
Commonly Used UML Diagrams
The most commonly used UML diagrams are:
– Use case diagram, describing how the system is
used.
• The starting point for UML modeling.
– Use case (not a diagram).
– Activity diagram.
• Each use case may create one activity diagram.
Kendall & Kendall
© 2005 Pearson Prentice Hall
18-2
Commonly Used UML Diagrams
The most commonly used UML diagrams
(continued):
– Sequence diagram, showing the sequence of
activities and class relationships.
• Each use case may create one or more sequence
diagrams.
• A collaboration diagram is an alternative to a sequence
diagram.
Kendall & Kendall
© 2005 Pearson Prentice Hall
18-3
Commonly Used UML Diagrams
The most commonly used UML diagrams
(continued):
– Class diagram, showing classes and relationships.
• Sequence diagrams and CRC cards are used to
determine classes.
– Statechart diagram.
• Each class may create a statechart diagram, useful for
determining class methods.
Kendall & Kendall
© 2005 Pearson Prentice Hall
18-4
Overview of UML Diagrams
Kendall & Kendall
© 2005 Pearson Prentice Hall
18-5
Use Cases
• Depiction of a system’s behavior or
functionality under various conditions as the
system responds to requests from users
• Full functioning for a specific business purpose
Use Case Diagram
• A use case describes what the system does, not how
it does the work.
• The use case model reflects the view of the system of
the user outside of the system.
• Symbols are:
– Actor, a stick figure.
– Use case, an oval.
– Connecting lines.
Kendall & Kendall
© 2005 Pearson Prentice Hall
18-7
UML Use Case Diagram Symbols
Use Case
Actor
Boundary
Connection
<<include>>
Include relationship
Extend relationship
<<extend>>
Store System
Buy Item
Refund a Purchased Item
Customer
Actors
• Represent role played by one or more users
• Exist outside of the system
• May be a person, another system, a device, such as a
keyboard or Web connection
• Can initiate an instance of a use case
• May interact with one or more use cases and a use
case may involve one or more actors
Kendall & Kendall
© 2005 Pearson Prentice Hall
18-10
Actors (Continued)
• Actors may be divided into two groups:
• Primary actors supply data or receive
information from the system
• Secondary actors help to keep the system
running or provide help
– Help desk, analysts, programmers, etc.
Kendall & Kendall
© 2005 Pearson Prentice Hall
18-11
What is a Boundary?
• A boundary is the dividing line between the
system and its environment.
• Use cases are within the boundary.
• Actors are outside of the boundary.
Use Case
• Consists of three things:
– An actor (user) that initiates an event.
– An event that triggers a use case.
– The use case that performs the actions triggered
by the event.
Kendall & Kendall
© 2005 Pearson Prentice Hall
18-13
Use Case (Continued)
• Better to create fewer use cases
• 20 use cases for a large system
• 50 use cases would be the maximum for a
large system
• Can nest use cases, if needed
Kendall & Kendall
© 2005 Pearson Prentice Hall
18-14
Use case for a Camera
What is a Connection?
• A connection is an association between an
actor and a use case.
• Depicts a usage relationship
• Connection does not indicate data flow
Use Case Relationships
• Communicates
– Connect an actor to a use case
• Includes (or uses)
– Use case contains a behavior that is common to
more than one use case.
– The common use case is included in other use
cases.
Kendall & Kendall
© 2005 Pearson Prentice Hall
18-18
What is an <<include>> Relationship?
• A connection between two use cases
• Indicates a use case that is used (invoked) by
another use case
• Links to general purpose functions, used by
many other use cases
Use Case Relationships (Continued)
• Extends
– A different use case handles variations or
exceptions from the basic use case.
– Arrow goes from extended to basic use case.
• Generalizes
– One thing is more general than another thing.
– Arrow points to the general thing.
Kendall & Kendall
© 2005 Pearson Prentice Hall
18-21
What is an <<extend>> Relationship?
• A connection between two use cases
• Extends a use case by adding new behavior or
actions
• Specialized use case extends the general use
case
Steps for Creating a
Use Case Model
The steps required to create a use case model
are:
– Review the business specifications and identify
the actors within the problem domain.
– Identify the high-level events and develop the
primary use cases that describe the events and
how actors initiate them.
Kendall & Kendall
© 2005 Pearson Prentice Hall
18-26
Steps for Creating a
Use Case Model
• The steps required to create a use case model
are (continued):
– Review each primary use case to determine
possible variations of flow through the use case.
– Develop the use case documents for all primary
use cases and all important use case scenarios.
Kendall & Kendall
© 2005 Pearson Prentice Hall
18-27
Example Use-Case Description
Use Case Example Store system
POST
Buy Item
Log In
Cashier
Customer
Refund a Purchased Item
Start Up
Manager
Manage Users
System Administrator
Adapted from Larman “Applying UML and Patterns”
And a Lot More
MH
Use-Case Description
Use case:
Actors:
Type:
Description:
Buy Item
Customer (initiator), Cashier
Primary
1. The Customer arrives at the checkout with items
to purchase.
2. The Cashier records the purchase items and
collects a payment.
3. On completion the Customer leaves with the items.
Cross Ref.:
Requirements XX, YY, and ZZ
Pre-conditions: Cashier must have completed the Log In use-case
Success-conditions: Customer has the item, Cashier has the money
Use Case Example Buy Goods
CHARACTERISTIC INFORMATION
Goal in Context: Buyer issues request directly to our company, expects
goods shipped and to be billed.
Preconditions: We know Buyer, their address, etc.
Success End Condition: Buyer has goods, we have money for the goods.
Failed End Condition: We have not sent the goods, Buyer has
Company is out of one
not spent the money.
of the items
Primary Actor: Buyer, any agent (or computer) acting for
the customer
«extend»
Trigger: purchase request
Buyer pays directly
comes in.
Buy Goods
«extend»
Stimuli
with credit card
Buyer
«extend»
Buyer returns goods
Use Case: 5
Buy Goods
Each step take the form ”A does X”, where A is
---------------------------------------an actor and X is an action. If a use case is
MAIN SUCCESS SCENARIO
included you will find a step that has the
1. Buyer calls in with a purchase request.
form ”include U”, where U is another use case.
2. Company captures buyer’s name,
Extension 3a is execute instead of 3 if condition:
address, requested goods, etc.
”Company is out of one of the ordered items” is
3. Company gives buyer information on
fulfilled!
goods, prices, delivery dates, etc.
Company is out of one
of the items
4. Buyer signs for order.
5. Company creates order, ships order to buyer.
«extend»
6. Company ships invoice to buyer.
Buyer pays directly
7. Buyers pays invoice.
Buy Goods
with credit card
«extend»
---------------------EXTENSIONS
Buyer
3a. Company is out of one of the ordered
«extend»
items:
3a1. Renegotiate order.
Buyer returns goods
4a. Buyer pays directly with credit card:
4a1. Take payment by credit card (use case
44)
7a. Buyer returns goods:
7a. Handle returned goods (use case 105)
More On Use Cases
• The last step in a extension can take one of the
following forms:
– Fail - use case is terminated and goal is not achived
– Stop - use case is terminated and goal is achived
– Resume N - execution should continue at step N in main success
scenario.
– If the last step is not one of the above, continue at main scenario.
One More Example
Initiator ReservationMaker
Goal
Reserve room(s) at a hotel
Main Success Scenario
1. ReservationMaker asks to make a reservation
2. ReservationMaker selects, in any order, hotel, dates and room type.
3. System provides price to ReservationMaker.
4. ReservationMaker asks for reservation.
5. ReservationMaker provides name, e-mail…
6. System makes reservation and allocates tag to reservation.
7. System reveals tag to ReservationMaker.
8. System creates and sends confirmation by e-mail.
Extensions
3. Room not available.
a. System offers alternatives.
b. ReservationMaker selects from alternatives.
3b. ReservationMaker rejects alternatives.
a. Fail
4. ReservationMaker rejects offer
a. Fail
5. Customer already on file
a. Resume 6
Orders
SubSystem
Submit Regular
Order
Member
Services
Department
Past
Member
Club
Member
Request Sales
Reports
Submit
Promotion Order
Request
Membership rpts
Submit
subscription
renewal
Create new
subscription
program
Marketing Department
Submit New Send subscription
Send new
Subscription
renewal offer
subscription offer
Create New
Seasonal
Promotion
Membership
System
Potential
Member
Member
Services System
Create New
Monthly
Promotion
Send Club
Promotion
Request
Promotion
Reports
Promotions
SubSystem
ACTORS
USE CASE
Club Member
Initiates
Submit Promotion Order
Submit Regular Order
Potential Member
Initiates
Submit New Subscription
Past Member
Initiates
Submit Subscription Renewal
Membership Services Dept.
Initiates
Request Membership Reports
Marketing Department
Initiates
Create New Monthly Promotion
Create New Seasonal Promotion
Create New Subscription Program
Request Promotion Reports
Request Sales Reports
Initiates
Send New Subscription Offer
Send Club Promotion
Send Subscription Renewal
Membership Services System
USE CASE NAME
ACTOR
DESCRIPTION
Normal Course
PRECONDITION
POST CONDITION
ASSUMPTIONS
Submit Promotion Order
Club Member
Describes the process when a club member submits a club promotion
order to either indicate the products they are interested in ordering or
declining to order during this promotion
1. This use is initiated when the club member submits the promotion
order to be proceeded
2. The club member's personal information such as address is validated
against what is currently recorded in member services
3. The promotion order is verified to see if product is being ordered
4. The club member's credit status is checked with Accounts Receivable
to make sure no payments are outstanding
5. For each product being ordered, validate the product number
6. For each product being ordered, check the availability in inventory
and record the ordered information which includes "quantity being
ordered" and give each ordered product a status of "open"
7. Create a Picking Ticket for the promotion order containing all ordered
products which have a status "open"
8. Route the picking ticket to the warehouse
Use case send club promotion has been processed
Promotion order has been recorded and the picking ticket has been
routed to the warehouse
USE CASE NAME
ACTOR
DESCRIPTION
NORMAL COURSE
ALTERNATE COURSE
Submit Promotion Order
Club Member
Describes the process when a club member submits a club promotion order to either indicate
the products they are interested in ordering or declining to order during this promotion
1. This use is initiated when the club member submits the promotion order to be proceeded
2. The club member's personal information such as address is validated against what is
currently recorded in member services
3. The promotion order is verified to see if product is being ordered
4. The club member's credit status is checked with Accounts Receivable to make sure no
payments are outstanding
5. For each product being ordered, validate the product number
6. For each product being ordered, check the availability in inventory and record the ordered
information which includes "quantity being ordered" and give each ordered product a status
of "open"
7. Create a Picking Ticket for the promotion order containing all ordered products which have a
status "open"
8. Route the picking ticket to the warehouse
2.
3.
4.
If the club member has indicated an address or telephone number change on the promotion
order, update the club member's record with the new information
If the club member is not ordering product at this time, modify the promotion order's status
to be "closed" and modify the selection of the month ordered product's record to have a
status of "rejected", then cancel the transaction
If Account Receivable returns a credit status that the customer is in arrears, invoke abstract
use case Send Order Rejection Notice Modify the promotion's order's status to be "on hold
pending payment"
5.
PRECONDITION
POST CONDITION
ASSUMPTIONS
a) If the product number is not valid, create an Order Error Report containing the club
member's information, the promotion order information, and the product number in
error. Each completed report will be routed to a Member Services clerk for
resolution.
b) If the club member is not ordering the selection of the month, modify the ordered
product's record to have a status of "rejected"
6. If the product being ordered is not available, record the ordered product information which
includes "quantity being ordered" and give a status of "backordered"
7. If there are no ordered product records with a status "open", cancel the transaction
Use case send club promotion has been processed
Promotion order has been recorded and the picking ticket has been routed to the warehouse
Guidelines for Developing Use-Case
Descriptions
•
Identify the Major Use Cases
1.
2.
3.
4.
Find the system’s boundaries
List the primary actors
List the goals of the primary actors
Identify and write the overview of the major use
cases for the above
5. Carefully review the current use cases. Revise as
needed.
Guidelines for Developing Use-Case
Descriptions
•
Expand the Major Use Case
6.
7.
8.
9.
Choose one of the use cases to expand
Start filling in the details of the chosen use case
Write the normal flow of events for the use case
If the normal flow of events is too complex or long,
decompose into subflows
10. List the possible alternate or exceptional flows
11. For each alternate or exceptional flow, list how the actor
and/or the system should react
Guidelines for Developing Use-Case
Descriptions
•
Confirm the Major Use Cases
13. Carefully review the current set of use cases.
Revise as needed.
14. Start at the top again.
Term Project
• Submit the Software Requirement
Specification (SRS) Document by April 1st.