Skip to content
Tutorials Center
My learning

Topics

Lesson 10 of 39 ยท Use Case and Activity Diagrams

Use Case Diagrams: Actors and Goals

Learn to draw use case diagrams: actors, use cases, the system boundary and associations, how to find use cases from user goals, and how to avoid common modeling errors.

Before you design classes, you need to know what the system is for. A use case diagram answers that from the outside: who uses the system and what do they want to achieve with it? It deliberately says nothing about how the system works inside. That makes it ideal for talking with customers, product owners and testers.

The building blocks

Element Symbol Meaning
Actor stick figure (or a box with <<actor>>) A role played by someone or something outside the system
Use case oval with a verb phrase A goal the system helps an actor achieve
System boundary rectangle around the use cases What is inside the system and what is outside
Association solid line The actor takes part in the use case

Mermaid has no use case diagram type, so we draw the same structure with a flowchart: stadium shapes for actors, ovals for use cases and a subgraph for the system boundary. In a UML tool the actor would be a stick figure.

flowchart LR
    Customer(["Customer"])
    Clerk(["Librarian"])
    subgraph Library["Library System"]
        UC1(("Borrow Book"))
        UC2(("Return Book"))
        UC3(("Search Catalog"))
        UC4(("Add New Book"))
    end
    Customer --- UC1
    Customer --- UC2
    Customer --- UC3
    Clerk --- UC2
    Clerk --- UC4

Customers borrow, return and search; librarians return books and add new ones.

Actors

An actor is a role, not a person. One human can play several roles (a student who is also a tutor), and one role can be played by many humans. Actors are always outside the system. They can be:

  • Primary actors who start a use case to reach a goal (Customer).
  • Secondary (supporting) actors that the system calls on to complete it (a payment gateway, an email service).
  • Systems or time itself (a nightly scheduler is an actor for "Generate Reports").

Name actors by role in the business: Customer, Approver, Payment Gateway. Avoid job titles that vary, and never name an actor after a program unit like Database; the database is inside your system.

Use cases

A use case is a goal-level, user-visible function that yields something of value to an actor. Name it with a verb and an object: Place Order, Reset Password, Approve Expense.

Good use cases:

  • Describe a complete interaction with a result (not "Click Button").
  • Are independent of design ("Save to database" is not a goal).
  • Can usually be done in a single sitting.

Bad names: Login Screen (a screen), Manage Users (too broad: it hides Create, Disable, Reset...), Validate Input (an internal step).

Finding use cases

Work from the actors outward.

  1. List the actors. Who uses, administers, feeds or receives data from the system?
  2. For each actor, ask: "What do you want to achieve?" Not "what buttons do you press?".
  3. Write each answer as a verb phrase. Merge duplicates.
  4. Ask: "What happens after?" and "what can go wrong?" to find more.
  5. Check each use case has at least one actor and each actor has at least one use case.
Python Check a use case model for orphans

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Both findings are red flags: an Auditor who does nothing probably means a missing use case, and Archive Old Loans with no actor is either triggered by time (add a "Scheduler" actor) or not a requirement at all.

The system boundary

The rectangle separates the system under design from the environment. Putting something inside the box means you will build it; outside means it already exists or someone else provides it. Drawing the boundary early prevents arguments such as "does our app handle the payments or the payment provider?".

Granularity

The hardest skill is choosing the right level. A rule of thumb: a use case should fit "one actor, one goal, one sitting".

Too big Right size Too small
Manage Orders Place Order Enter Quantity
Run the Library Borrow Book Scan Barcode
Handle Accounts Reset Password Click "Send Email"

Too-big use cases hide requirements. Too-small ones are steps, and steps belong inside the use case description, which you will write in Use Case Specifications.

Python A quick granularity check on names

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Use case diagram, 4 parts

Actors Roles outside the system.
Use cases Verb + object goals.
Boundary What we build.
Associations Who takes part.

Actor, goal, one sitting.

1 / 2

What use case diagrams are not

  • Not a flow chart. They show no order of steps. Order belongs in activity diagrams and use case text.
  • Not a user interface map. A single use case may span many screens.
  • Not a complete specification. A diagram is a table of contents; the detail is in the written use cases.

Keep diagrams to 5-10 use cases. For a larger system, draw one diagram per subsystem or per actor group rather than one giant picture.

Common mistakes

  • Actors inside the system. Departments of your own company are actors only if they use the system.
  • Arrows between actors or between use cases without a relationship type. Use generalization, include or extend (next lesson); a plain association between use cases is not valid.
  • Use cases named like functions (calculateTax). Name goals, not procedures.
  • Forgetting secondary actors such as external payment, email or identity providers.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is an actor in a use case diagram?

    Actors are roles in the system's environment, played by people or other systems.
  2. 2. Which name is best for a use case?

    A good use case is a verb phrase naming a complete, user-visible goal.
  3. 3. What does the system boundary rectangle tell you?

    The boundary divides the system under design from its environment.
  4. 4. A nightly job that triggers report generation is best modeled as:

    Time or scheduler can be an actor that starts a use case from outside.

Summary

  • Use case diagrams show who uses the system and what goals they pursue, not how it works.
  • Actors are external roles (primary or secondary); use cases are verb-phrase goals.
  • The system boundary separates what you build from its environment.
  • Right-size use cases: one actor, one goal, one sitting.
  • Check for orphan actors and use cases; keep diagrams small.

Next: Use Case Relationships: Include, Extend, Generalization