Software Engineering Principles and Practices / Software Requirement Engineering

Use Case Diagrams

A Use Case Diagram shows the relationship between Actors and Use Cases. It defines the "scope" of your system—what is inside the app and what is outside.


🧱 The Four Basic Components

Every Use Case Diagram consists of these four elements:

  1. The Actor: * Represented by a stick figure.

    • An Actor is a role played by a user or an external system (like a Payment Gateway or a Database).

    • Note: An actor is a role, not a specific person (e.g., "Customer," not "John Doe").

  2. The Use Case: * Represented by an oval.

    • A specific task or function the system performs (e.g., "Login," "View Balance," "Checkout").

  3. The System Boundary: * Represented by a rectangle drawn around the use cases.

    • It separates the system from the actors. Use cases go inside; actors stay outside.

  4. Relationships: * Represented by lines connecting actors to use cases.


🖇️ Relationships (Advanced)

Beyond the simple line, there are two special relationships between Use Cases that help manage complexity:

  • <<include>>: Used when one use case must happen for another to work.

    • Example: "Withdraw Cash" includes "Authenticate User." You can't have one without the other.

  • <<extend>>: Used for optional behavior or special cases.

    • Example: "Calculate Shipping" might extend "Checkout," but only if the user chooses international shipping.


📝 How to Create a Use Case Diagram

To draw one for your project, follow these steps:

  1. Identify the Actors: Who uses the system? (Admin? Guest? External Bank API?).

  2. Identify the Use Cases: What are the main goals of these actors? (Keep these as verbs: "Add Item," "Delete User").

  3. Draw the Boundary: Put your use cases in the box.

  4. Connect them: Draw lines to show which actor performs which task.


📊 Example: ATM System

Actor

Use Cases

Customer

Check Balance, Withdraw Cash, Deposit Funds

Bank Technician

Maintenance, Repair, Refill Cash

Bank Server

Verify Identity (External Actor)


✨ Why use them?

  • Simplicity: Anyone can understand them, even non-technical clients.

  • Scope Definition: It clearly shows what the system will not do (if it’s not in the box, it’s not being built).

  • Testing Basis: Each use case usually becomes a major Test Suite later in the project.