You are on page 1of 29

An Introduction to Use Cases

Outline
Why use cases?
What are actors and use cases? How do we write use cases?

2
Copyright 2002-2004 Serlio Software Development Corporation

Unstable Requirements
Leading cause of runaway projects* Most expensive errors to fix Hardest errors to correct
User involvement is key
*Facts and Fallacies of Software Engineering, Robert L. Glass, 2003, Addison-Wesley 3
Copyright 2002-2004 Serlio Software Development Corporation

Software Project Success Rate


Source: Standish Group 1999

100% 90% 80% 70% 60% 50% 40% 30% 20% 10% 0% < $750k $750k $1.5M $1.5M - $3M $3M - $6M $6M - $10M > $10M

Total Cost

4
Copyright 2002-2004 Serlio Software Development Corporation

Requirements Specifications
Easily misunderstood Too large to comprehend Hard to test for completeness Provide no context

5
Copyright 2002-2004 Serlio Software Development Corporation

Why Use Cases?


The hard part: Build the right thing Describes behavior of the system Easily understood by
Problem-oriented stakeholders Solution-oriented stakeholders

Focus on actual system needs


6
Copyright 2002-2004 Serlio Software Development Corporation

Outline
Why use cases?
What are actors and use cases? How do we write use cases?

7
Copyright 2002-2004 Serlio Software Development Corporation

What Is An Actor?
A role, not a person Human or non-human Three essential traits
External to the system Interacts with the system Tries to achieve a goal
Copyright 2002-2004 Serlio Software Development Corporation

Claims adjuster

Why Define Actors?


Establishes need for a requirement Focus on how the system is used Defines system boundaries Determines completeness Shows who knows requirements

9
Copyright 2002-2004 Serlio Software Development Corporation

What Is a Use Case?


Describes one way to use the system Essential traits:
Centered around a goal Describes steps to achieve that goal Written as a series of interactions Yields a result to the actor
10
Copyright 2002-2004 Serlio Software Development Corporation

Use Case Simple Example


Name: Generate Quote Primary Actor: Insurance Quoter Brief Description: Insurance Quoter creates an insurance quote for her automobile.
Primary Flow: The use case begins when Insurance Quoter asks the system for a quote. The system asks Insurance Quoter for her home address. After Insurance Quoter gives her name and address, the system asks what vehicle they would like to insure. Insurance Quoter identifies the vehicle to insure. The system then presents a list of coverages and levels. Insurance Quoter selects her desired coverage levels and asks for the quote. The system presents the quote, including the premium for each coverage.

11
Copyright 2002-2004 Serlio Software Development Corporation

Types of Requirements
Functional Non-Functional
Usability Reliability Portability Supportability + (legal)

Terminology

The system should generate insurance quotes. The system should handle 30,000 quote requests per hour.
12

Copyright 2002-2004 Serlio Software Development Corporation

Outline
Why use cases?
What are actors and use cases? How do we write use cases?

13
Copyright 2002-2004 Serlio Software Development Corporation

The Use Case Writing Process


1. 2. 3. 4. 5. 6. Identify actors Identify use cases Prioritize use cases Write use case descriptions Review and revise Go to step 3 Capture non-functional requirements Capture terminology
14
Copyright 2002-2004 Serlio Software Development Corporation

Identify Actors
Actor Name:
Customer

Description:
A customer is an individual or business that currently has a relationship with the bank. For the purposes of the loan management system, a customer is someone who holds an active loan account or has been extended credit.

Goals:
Be informed of a payment due Make a loan payment Check loan balance
15
Copyright 2002-2004 Serlio Software Development Corporation

Identify Use Cases


A use case is an event
Not an information flow Not a process flow
Evaluate Loan Application

Use a short, verb-noun combination Describe the interaction Reflect the actors goal

Close Out Loan

Generate Late Notice

16
Copyright 2002-2004 Serlio Software Development Corporation

Use Case Diagrams

Generate Quote Accounting System

Insurance Quoter

Buy Coverage

17
Copyright 2002-2004 Serlio Software Development Corporation

Formality Of Use Cases

Brief

Primary Scenario

Fully Dressed
18
Copyright 2002-2004 Serlio Software Development Corporation

Detailing a Use Case


Name and Brief Summary

Alternate/Extension
Primary Flow (Interaction) Alternate/Extension

Supplemental Information Preconditions Success guarantee Other requirements Open issues

Alternate/Extension

19
Copyright 2002-2004 Serlio Software Development Corporation

Primary Flow
Cancel Order Use Case Flow of Events 1. The use case begins when the customer rep asks the system to cancel an order. 2. The customer rep searches for the order by order ID. 3. The system presents the order. 4. The customer rep marks the order as cancelled. 5. The system cancels the order. 6. The system tells the accounting subsystem to credit the customers account.

20
Copyright 2002-2004 Serlio Software Development Corporation

Preconditions
Defines use case scope and place
What has already happened?

Required state of the system Written in the present tense

21
Copyright 2002-2004 Serlio Software Development Corporation

Precondition Examples
The broker is logged on. The order status is complete. The quote is valid. The divert location is in service.

22
Copyright 2002-2004 Serlio Software Development Corporation

Postcondition
A.K.A Success Guarantee Required state of the system Written as an assertion, past tense Describes the satisfied interests

23
Copyright 2002-2004 Serlio Software Development Corporation

Postcondition Examples
The email was sent. The file was saved. The policy was cancelled. The system credited the customers account.

24
Copyright 2002-2004 Serlio Software Development Corporation

Extensions
We know the main success scenario The world doesnt work this way Software is no exception We need a way to describe:
Failure conditions Alternative/conditional steps in the flow
25
Copyright 2002-2004 Serlio Software Development Corporation

Extensions: Mechanics
Insertion point Extension condition Alternate steps

26
Copyright 2002-2004 Serlio Software Development Corporation

Extensions: Writing the Condition


Write as an assertion
That the system can detect Identify the insertion point

Say what was detected Replaces the insertion point step

27
Copyright 2002-2004 Serlio Software Development Corporation

Extension Example
Pack Order: 5. The packing clerk scans the item and places it in the carton. 6. The system records that the item was packed and updates the order. Extensions: *a. The order management system is unavailable. 1. 6a. The item does not belong on the order. 1. 6b. The order was cancelled. 1. 6c.The item has been recalled.
28
Copyright 2002-2004 Serlio Software Development Corporation

Summary
Why use cases?
What are actors and use cases? How do we write use cases?

29
Copyright 2002-2004 Serlio Software Development Corporation

You might also like