Use Cases

Michael L. Collard, Ph.D.

Department of Computer Science, The University of Akron

Requirements

  • Describes what the system is supposed to do
  • Often is given in English (i.e., not in a formal language)
  • If a system does not meet the actual requirements, then it has failed
  • Requirements Engineering
  • Requirements Elicitation

Use Case Diagrams

Description of a system's behavior as it responds to a request that originates from outside of that system

  • Describes a set of sequences
  • Each sequence represents the interactions of things outside the system (actors) with the system itself (and fundamental abstractions)
  • Use cases represent the functional requirements of the system (non-functional requirements are specified elsewhere)

Use Case

  • Each use case has a descriptive name
  • Describes what not how
  • Use case names must be unique within a given package
  • Examples: Withdraw Money, Process Loan

Actor

  • Actors have a name
  • An actor is a set of roles that users of use cases play when interacting with the system
  • They are external entities, e.g., people, other systems
  • Examples: Customer, Loan officer

What is a Use Case?

  • Use case captures some user-visible functionality
  • Granularity of functionality depends on the level of detail in your model
  • Each use case achieves a discrete goal for the user
  • Use Cases are generated through requirements elicitation

Goals vs. Interaction

  • Goals - something the user wants to achieve
  • Format a document
  • Ensure consistent formatting of two documents
  • Interaction - things the user does to achieve the goal
  • Define a style
  • Change a style
  • Copy a style from one doc to the next

Point of Sale Terminal

Extend and Include

Generalization

Use Case Diagram

Create Use Case Diagram

Developing Use Cases

  • Understand what the system must do - capture the goals
  • Understand how the user must interact to achieve the goals - capture user interactions
  • Identify sequences of user interactions
  • Start with goals and refine them into interactions

Casual  Contents Cockburn'01

  • Title (goal)
  • Primary Actor
  • Scope
  • Level
  • (Story): paragraph or two of text in the body of the use case

Fully-Dressed  Contents Cockburn'01

  • Title
  • Primary Actor
  • Goal in Context
  • Scope
  • Level
  • Stakeholders and Interests
  • Precondition
  • Minimal Guarantees
  • Success Guarantees
  • Trigger
  • Main Success Scenario
  • Extensions
  • Technology & Data Variations List
  • Related Information

User Story

  • Title: Search and Replace
  • Description: A user realizes they incorrectly capitalized a word everywhere on a website. So they tell the web page editor to search for all occurrences and replace them with the corrected word.
  • Priority:
  • Estimate:

User Stories vs. Use Cases

  • User stories are about needs, use cases are about behavior in the software to meet those needs
  • User stories are easy for users to read, use cases describe the complete interaction
  • One user story may map to several use cases