Use Case Diagrams

📌 What is a Use Case Diagram?

A Use Case Diagram is a behavioral UML diagram that visually represents the interactions between users (actors) and a system's functionalities (use cases). It focuses on what the system does rather than how it does it.

Purpose:

  • Capture functional requirements of a system.

  • Illustrate system behavior as seen by external users.

  • Identify key actors and their goals when interacting with the system.


🎯 Key Elements of a Use Case Diagram

Element

Description

Symbol/Notation

Actors

Users or external systems interacting with system

Stick figure or name label

Use Cases

Functionalities/services provided by system

Oval shape with name inside

System Boundary

Shows scope of system

Rectangle enclosing use cases

Relationships

Connections between actors and use cases

Lines, arrows, include/extend arrows


Types of Relationships in Use Case Diagrams

Relationship

Description

Symbol

Association

Actor interacts with use case

Solid line

Include

Mandatory behavior included in another use case

Dotted arrow with <<include>> label

Extend

Optional/conditional behavior that extends another use case

Dotted arrow with <<extend>> label

Generalization

One actor inherits behavior from another (specialization)

Solid line with hollow arrow


🧭 How to Create a Use Case Diagram (Step-by-Step)

  1. Identify Actors: Who uses the system? (Users, other systems).

  2. Identify Use Cases: What functionalities does the system provide?

  3. Define System Boundary: What is inside vs. outside the system?

  4. Establish Relationships: Connect actors to use cases, define dependencies.

  5. Organize and Label Clearly: Keep diagram simple and readable.


📊 Example of a Use Case Diagram

Scenario: Online Shopping System

Actors

Use Cases

Customer

- Browse Products - Add to Cart - Checkout - Track Order

Admin

- Manage Products - Manage Orders

Payment Gateway (System)

- Process Payment

Diagram Representation (Text version):

pgsqlCopyEdit            +---------------------------------------+
            |         Online Shopping System        |
            |                                       |
            |   (Browse Products)                   |
            |   (Add to Cart)                       |
            |   (Checkout) ----<<include>>-- (Process Payment)  |
            |   (Track Order)                       |
            |   (Manage Products)                   |
            |   (Manage Orders)                     |
            +---------------------------------------+
                ^             ^          ^
             Customer      Admin     Payment Gateway

💡 Example Relationships Explained:

  • Customer — Browse Products: Direct interaction (association).

  • Checkout <<include>> Process Payment: Payment is mandatory during checkout.

  • Admin — Manage Products/Orders: Admin role functionality.

  • Payment Gateway — Process Payment: External system involved in transaction.


🚀 Benefits of Use Case Diagrams

Benefit

Explanation

Clarifies Requirements

Shows system functionality and user interaction clearly.

Communicates Scope

Defines what is and isn't part of the system.

Enhances Stakeholder Communication

Visual representation helps non-technical stakeholders understand.

Foundation for System Design

A starting point for detailed functional requirements and user stories.


🔑 Best Practices for Use Case Diagrams

  • Keep diagrams simple and focused.

  • Use clear, descriptive names for use cases.

  • Limit number of elements to avoid clutter.

  • Focus on main user goals and system interactions.

  • Use include/extend relationships appropriately to avoid repetition.


🎯 Summary of Use Case Diagrams

Aspect

Details

Purpose

Visualize user-system interaction, capture functional requirements

Key Elements

Actors, Use Cases, System Boundary, Relationships

Main Relationships

Association, Include, Extend, Generalization

Outcome

Clear understanding of what the system will do for different users

Last updated