Labs ICT
⭐ Pro Login

Use Case Modeling

Capturing functional requirements with use cases and scenarios.

What is a Use Case?

A use case describes a specific way that a system interacts with its users (actors) to achieve a particular goal. It captures the functional requirements of a system from the user's perspective β€” what the system does, not how it does it internally.

Think of use cases as stories: "As a [role], I want to [action] so that [benefit]." Each use case represents one complete interaction that delivers value to an actor.

Use Case: "Place an Order"
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Actor: Customer                                     β”‚
β”‚ Goal: Successfully place an order for items         β”‚
β”‚                                                     β”‚
β”‚ Preconditions:                                      β”‚
β”‚   β€’ Customer is logged in                           β”‚
β”‚   β€’ Cart has at least one item                      β”‚
β”‚   β€’ Customer has a valid shipping address           β”‚
β”‚                                                     β”‚
β”‚ Main Flow:                                          β”‚
β”‚   1. Customer reviews cart                          β”‚
β”‚   2. Customer proceeds to checkout                  β”‚
β”‚   3. System displays order summary                  β”‚
β”‚   4. Customer selects payment method                β”‚
β”‚   5. System processes payment                       β”‚
β”‚   6. System confirms order                          β”‚
β”‚   7. System sends confirmation email                β”‚
β”‚                                                     β”‚
β”‚ Alternative Flows:                                  β”‚
β”‚   5a. Payment fails β†’ Show error, return to step 4  β”‚
β”‚   5b. Card declined β†’ Suggest different payment     β”‚
β”‚                                                     β”‚
β”‚ Postconditions:                                     β”‚
β”‚   β€’ Order is created with status "confirmed"        β”‚
β”‚   β€’ Inventory is decremented                        β”‚
β”‚   β€’ Payment is recorded                             β”‚
β”‚   β€’ Confirmation email is sent                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Anatomy of a Use Case

Every well-written use case has these key components:

1. Name
   A clear, verb phrase describing the goal.
   "Register Account", "Search Products", "Generate Report"

2. Actor
   Who or what initiates or participates in the use case.
   Can be a human user, external system, or timer.

3. Preconditions
   What must be true before the use case can start.
   "User must be authenticated" or "Cart is not empty"

4. Main Flow (Happy Path)
   The step-by-step sequence for the successful scenario.
   Each step describes an interaction between actor and system.

5. Alternative Flows
   Variations that occur when conditions differ.
   "Payment declined" or "Item out of stock"

6. Exception Flows
   Error conditions and how the system handles them.
   "Network timeout" or "Invalid input"

7. Postconditions
   What is true after the use case completes successfully.
   "Order is created" or "Email is sent"

Identifying Use Cases

Use cases come from analyzing the goals and tasks of each actor in the system. Start by listing what each actor wants to accomplish:

System: Online Bookstore

Actors and their goals:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Actor        β”‚ Goals                                    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Customer     β”‚ β€’ Browse books                          β”‚
β”‚              β”‚ β€’ Search for specific books              β”‚
β”‚              β”‚ β€’ Add books to cart                      β”‚
β”‚              β”‚ β€’ Place an order                         β”‚
β”‚              β”‚ β€’ Track order status                     β”‚
β”‚              β”‚ β€’ Return a book                          β”‚
β”‚              β”‚ β€’ Write a review                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Admin        β”‚ β€’ Add/edit/remove books                  β”‚
β”‚              β”‚ β€’ Manage inventory                       β”‚
β”‚              β”‚ β€’ View sales reports                     β”‚
β”‚              β”‚ β€’ Process returns                        β”‚
β”‚              β”‚ β€’ Manage user accounts                   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ System       β”‚ β€’ Send order confirmations               β”‚
β”‚              β”‚ β€’ Process payments                       β”‚
β”‚              β”‚ β€’ Update inventory                       β”‚
β”‚              β”‚ β€’ Generate invoices                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Each goal becomes a use case candidate.
Filter: is it specific enough? Does it deliver value?

Use Case Relationships

Use cases can relate to each other in three ways:

1. Include (Β«includeΒ»)
   ─────────────────────
   One use case REQUIRES another to complete.
   The base use case always includes the included one.

   "Place Order" Β«includeΒ» "Process Payment"
   You can't place an order without processing payment.

2. Extend (Β«extendΒ»)
   ──────────────────
   One use case EXTENDS another with optional behavior.
   The extension only happens under certain conditions.

   "Place Order" Β«extendΒ» "Apply Discount Code"
   Discounts are optional β€” not every order has one.

3. Generalization
   ──────────────
   A child use case inherits from a parent use case.
   The child specializes the parent's behavior.

   "Make Payment" β–Ά "Pay with Credit Card"
                   "Pay with PayPal"
                   "Pay with Bank Transfer"
Example Use Case Diagram:

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚              Online Bookstore                    β”‚
  β”‚                                                  β”‚
  β”‚   Β«includeΒ»                                      β”‚
  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
  β”‚  β”‚  Process      │◀────│  Place Order      β”‚     β”‚
  β”‚  β”‚  Payment      β”‚      β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚
  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜               β”‚                β”‚
  β”‚                           Β«extendΒ»                β”‚
  β”‚                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”           β”‚
  β”‚                    β”‚  Apply Discount   β”‚           β”‚
  β”‚                    β”‚  Code             β”‚           β”‚
  β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚
  β”‚                                                  β”‚
  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
  β”‚  β”‚  Browse Books    β”‚  β”‚  Search Books    β”‚     β”‚
  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚
  β”‚                                                  β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β–²                    β–²
          β”‚                    β”‚
    β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
    β”‚ Customer  β”‚      β”‚   Admin     β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Writing Good Use Cases

Follow these guidelines for effective use cases:

DO:
  βœ“ Use clear, action-oriented titles ("Place Order", not "Order")
  βœ“ Write steps from the actor's perspective
  βœ“ Keep steps atomic (one action per step)
  βœ“ Include all alternative and exception flows
  βœ“ Define clear preconditions and postconditions

DON'T:
  βœ— Mix multiple goals into one use case
  βœ— Include implementation details ("System queries MySQL database")
  βœ— Use vague language ("System handles things properly")
  βœ— Create use cases for every tiny action ("Click button")
  βœ— Forget error scenarios
Bad Use Case Steps:
  1. User clicks button
  2. System processes data
  3. Something happens

Good Use Case Steps:
  1. Customer selects items and clicks "Checkout"
  2. System displays order summary with items, quantities, and total
  3. Customer selects payment method (Credit Card, PayPal, or Bank Transfer)
  4. Customer enters payment details and clicks "Confirm Payment"
  5. System validates payment information
  6. System processes the payment with the payment gateway
  7. System creates the order with status "Confirmed"
  8. System displays order confirmation with order number
  9. System sends confirmation email to customer's registered email

πŸ§ͺ Quick Quiz

What is a use case?