Requirements Modelling - (Use Cases)
Requirements Modelling - (Use Cases)
use case 2
use case 3
Actor 1
use case 4
use case 5
use case 6
Actor 2
System name
Generic Use Case Diagram for a System [2]
Primary
Actor use case 1 Labelled use case and connecting line
use case 2
use case 3
Actor 1
use case 4
Supporting
Actor
use case 5
use case 6
Actor 2
System name Labelled boundary
16
A Simple Use Case Example
• For a banking system:
• There are two (2) users/clients/actors, namely:
✓A Customer, who can view his/her account(s), transfer money,
withdraw money and view statements.
✓A Bank Clerk (or Bank Employee), who can add or remove customers
and add or remove accounts.
• Required:
✓Identify and name each unique process (i.e. UC), and then draw a UC
diagram.
view account
transfer money
withdraw money
Customer
view statement
add customer
remove customer
Banking System
order meal
Waiter
cook meal
eat meal
Customer Chef
Restaurant System
create sale
create return
Cashier Accounting
System
create sale
create return
Cashier Accounting
System
cook meal
Chef
Customer Use Case Diagram: Restaurant
Validating and Refining Use Cases
• CRUD technique:
✓Create a new instance of a thing,
✓Read/Report on a thing.
✓Update data relating to a thing.
✓Delete an instance of a thing (usually ARCHIVE, not actually delete…
why?).
• Based on what we might need to do with “things” in our
environment.
• Very focused on data and database design.
• Often used as a cross-check to ensure that use cases are not
missed, i.e. is the scope we communicate to the client complete?
Simplified CRUD Steps
1. Use the domain model class diagram to identify all entities
or “things” or domain classes in the system.
Use Case Diagram: Banking System Use Case Diagram: Banking System
32
The Deliverable: A Use Case Set
• All identified use cases are compiled into a use case set.
• Essentially a structured list.
• Related use cases are grouped together under appropriate
headings.
• Key functionality is thereby made obvious, therefore…
• A comprehensive use case set gives us…
• … the PROJECT SCOPE
• This can be communicated to and negotiated with the client with
either the structured list OR be used to generate a project
scope statement in paragraph form.
Use Case Set Example [1]
• Customer-related use cases:
✓Create customer
✓Read/view customer
✓Update customer
• Sale-related use cases
✓Create sale
✓Read/view sale
✓Update sale
• Return-related use cases:
✓Create return
✓Read/view return
✓Update return
• Reporting-related use cases:
✓Generate report
Simple Use Case Set Example [2]
• Customer-related use cases:
• Create customer
• Read/view customer
• Update customer
• Sale-related use cases
• Create sale These relate to identified “things”
• Read/view sale
• Update sale
• Return-related use cases:
• Create return
• Read/view return
• Update return
• Reporting-related use cases: This remains generic at this point
and is included by default. Indicates
• Generate report a use case that provides access to
our reporting functionality.
35
Use Case Sets can be tabular and include
more details
Class UC Name Related UCs
Read customer
Read sale
• Some are valid use cases, but can they be named better?
We can also try a Process/Event driven
Approach (UC Identification)
• Use cases are identified by determining the business events to
which the system must respond.
• This is called event decomposition (or event analysis).
• An event is something that occurs at a specific time and place, can
be precisely identified and must be remembered by the system.
• It is usually something that produces, uses or modifies data within
the system, i.e. affects the underlying database in some way.
• Often a group of events can belong to the same use case, e.g. enter
item, enter payment amount, calculate change all belong to Create
sale.
Types of Events
• External events occur outside the system and are usually initiated by
an external actor, usually “the user”.
✓e.g. A customer places an online order; A student submits a course
registration form; A user logs into their account.
• Temporal events occur as a result of reaching a certain point in time.
✓e.g. A bank automatically deducts a loan payment on the due date; A
system generates a monthly sales report at midnight; A reminder email is
sent one day before an appointment.
• State events occur when something happens inside the system that
triggers some process.
✓e.g. A membership status changes from “active” to “expired” when the
subscription period ends; An inventory system automatically reorders
stock when the quantity falls below a certain level; A loan application
moves to the next approval stage once all required documents are
uploaded.
Separating events from things that happen
before (triggers) and after (responses)
The True Power of Use Cases
• Diagramming is the easy part .
• Many regard use case diagrams as secondary in use case
work.
• Use cases are text documents, which means doing use case
work means to write text.
• These text documents (or text models) are known as use case
descriptions.
• Use case descriptions have three varying levels of detail, i.e.
• Brief, intermediate, detailed.
• Sometimes called brief, casual and fully dressed ☺.
Use Case Formats
• Brief
• Terse/concise/succinct, one paragraph summary.
• Covers a single, usually well-understood success scenario.
• Done during early requirements analysis for a quick sense of scope and
requirements, i.e. only a first step.
• Intermediate/Casual
• Multiple paragraph format containing more detail, also covering potential
variations/exceptions.
• Still used as above, i.e. early in the process.
• Detailed/Fully dressed
• All steps (including potential variations/exceptions) written in detail for fuller
understanding.
• Include supporting sections such as pre- and post-conditions, exceptions etc.
• Only a few significant and high-value use cases are written in detail
(sometimes only around 10%) before design and programming starts,
especially in “newer”, more agile approaches to systems development.
Detailed/fully Dressed Use Case Template
Use case name: Verb-noun phrase format
Scope: Name of the system or sub-system of which this use case is a
part
Triggering event: What sets the use case in motion?
Brief description: One paragraph summary (i.e. the brief use case description)
Actor(s): Primary and supporting actors (classified)
Related use cases: Use cases that will/may be invoked
Stakeholders and interests: Who cares about this use case and why?
Pre-conditions: What must be true for the use case to begin?
Post-conditions: What must be true after successful execution?
Flow of activities: List the process in numbered sequence, assuming a successful
(sometimes called outcome and using the perfect technology assumption
Main success scenario: or Note: Sometimes called the “happy path” ☺
Basic flow:)
Extensions: List alternative scenarios of success or failure
(sometimes called Note: Alternative/branching/exception statements are often
Alternative flows:) deferred to this section
50
Flow of Activities Section
Expressed in a two-column, numbered, sequential format that
shows actor and system responsibilities, e.g.
Flow of Actor System
activities: 1. A new customer requests 1.1 Prompts customer to
to create an account enter demographic data
• Write a fully dressed use case description for the Create sale use case based on the
following process description:
✓ A Customer arrives at a checkout point with one or more items to purchase. The Cashier requests to
create a new sale. As each item is added to the sale, the system displays a description of that item
and a running total. Items and descriptions are held in an external Inventory System. After all items
have been added, the Cashier indicates the end of the sale and the system displays the total cost.
The Cashier captures the Customer’s payment on the system and the system then requests the
Inventory System to update the stock level(s) based on the new sale. The system generates and
prints a receipt which the Cashier hands over to the Customer. The Customer then leaves with the
items.
Use case name: Create sale
Scope: Point of sale (POS) system
Triggering event: Cashier requests to create a sale
Brief description: Summary of the process (see previous slide, but remember the shirt
example!)
Actor(s): Cashier (Primary)
Inventory System (Supporting)
Related use cases: N/A
Stakeholders & interests: Cashier: Wants quick and accurate capture of sales
Customer: Wants to purchase items quickly and receive proof of
purchase
Inventory System: Wants update requests in correct format/structure
Retail organisation: Wants quick and accurate transaction
processing, clean data for reporting purposes and customer
satisfaction
Pre-conditions: N/A
Post-conditions: Sale is recorded in the system
Inventory update request has been sent to the Inventory System
Receipt is generated
Flow of activities: 1. Cashier requests to create sale 1.1 Prompts for item
• Doing the top half before the bottom half is like compiling the highlights
package before you have watched the football match.
Administrator
Update Customer
58
Use Case Diagram: Update customer
Practice Exercise
• Consider the following scenario:
• Students may have their demographic data and/or status, e.g. “YOS1” for
first year, “YOS2” for second year etc., updated by administrators at the
Faculty Office. The administrator requests to begin the update process.
He/she then enters the student’s student number when prompted. The
system uses the student number to retrieve and display the student’s
demographic data and current status as confirmation and prompts for a
choice of update (demographic data or status change). The administrator
makes his/her selection and then enters the update according to
appropriate prompts from the system. The system then captures the
update. Both the administrator and the student receive e-mail
confirmation when the update is successful.
✓Construct a PARTIAL fully-dressed use case description including: use case
name, triggering event, actor(s), related use cases, pre-conditions, post-
conditions, flow of activities and extensions (if necessary).
✓Draw a use case diagram for the use case. 59
Any Questions?
Thank You!