Labs ICT
⭐ Pro Login

Actor Analysis & Use Case Diagrams

Identifying actors and drawing use case diagrams to model system interactions.

What is an Actor?

An actor is any entity that interacts with the system from the outside. Actors initiate use cases, respond to system events, or exchange information with the system. They represent roles that users or external systems play when using your software.

Important: an actor is not a specific person β€” it's a role. One person might play multiple actors (e.g., someone can be both a "Customer" and an "Admin"). And an actor doesn't have to be human β€” it can be an external system, a timer, or a hardware device.

Types of Actors:

1. Primary Actor
   ──────────────
   Initiates the use case to achieve a goal.
   "Customer places an order" β†’ Customer is primary

2. Secondary Actor
   ────────────────
   Provides a service or responds to the system.
   "System sends email" β†’ EmailService is secondary

3. External System
   ────────────────
   Another software system that interacts with yours.
   "Payment processed by Stripe API" β†’ Stripe is external

4. Timer/Clock
   ────────────
   Triggers events at specific times.
   "Daily report generated at midnight" β†’ Timer is actor

Examples for an E-commerce System:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Actor          β”‚ Type        β”‚ Interacts When   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Customer       β”‚ Primary     β”‚ Browses, buys    β”‚
β”‚ Admin          β”‚ Primary     β”‚ Manages system   β”‚
β”‚ Warehouse      β”‚ Secondary   β”‚ Fulfills orders  β”‚
β”‚ Payment Gatewayβ”‚ External    β”‚ Processes paymentβ”‚
β”‚ Email Service  β”‚ External    β”‚ Sends emails     β”‚
β”‚ Backup Timer   β”‚ Timer       β”‚ Nightly backups  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Identifying Actors

To find actors, ask these questions about your system:

1. Who uses the system?
   β†’ Customers, administrators, support staff

2. Who provides data to the system?
   β†’ Data entry clerks, external APIs, sensors

3. Who receives output from the system?
   β†’ Managers (reports), customers (notifications)

4. What external systems does the system interact with?
   β†’ Payment gateways, email servers, databases

5. Who maintains the system?
   β†’ System administrators, DevOps engineers

6. Are there scheduled events?
   β†’ Timers, cron jobs, batch processors

Once you've identified candidates, validate them. A good actor should have at least one use case β€” if it doesn't interact with the system at all, it's not an actor.

Actor Generalization

When multiple actors share common use cases, you can use actor generalization to model the relationship. The child actor inherits all use cases from the parent and may add its own.

Actor Generalization Example:

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚    User      β”‚  (base actor)
  β”‚              β”‚
  β”‚ β€’ Login      β”‚
  β”‚ β€’ Logout     β”‚
  β”‚ β€’ Update     β”‚
  β”‚   Profile    β”‚
  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
    β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”
    β–Ό         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Customer β”‚ β”‚  Admin   β”‚
β”‚          β”‚ β”‚          β”‚
β”‚ β€’ Browse β”‚ β”‚ β€’ Manage β”‚
β”‚ β€’ Buy    β”‚ β”‚   Users  β”‚
β”‚ β€’ Review β”‚ β”‚ β€’ View   β”‚
β”‚          β”‚ β”‚  Reports β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Both Customer and Admin can login/logout/update profile.
Customer adds: browse, buy, review.
Admin adds: manage users, view reports.

Use Case Diagrams

A Use Case Diagram is a UML diagram that shows the actors, use cases, and their relationships. It provides a high-level overview of the system's functionality.

UML Use Case Diagram Notation:

  Actor:              Stick figure
  β”Œβ”€β”€β”€β”
  β”‚   β”‚
  β””β”€β”¬β”€β”˜
    β”‚

  Use Case:          Oval with name
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  Use Case    β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

  System Boundary:   Rectangle
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚           System             β”‚
  β”‚                              β”‚
  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
  β”‚  β”‚     Use Case           β”‚  β”‚
  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

  Associations:      Solid lines connecting actors to use cases
  Β«includeΒ»:         Dashed arrow with Β«includeΒ» label
  Β«extendΒ»:          Dashed arrow with Β«extendΒ» label
  Generalization:    Solid arrow with hollow triangle
Complete Example: Hospital Appointment System

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               Hospital Appointment System               β”‚
β”‚                                                        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚
β”‚  β”‚  Make            β”‚    β”‚  Cancel          β”‚         β”‚
β”‚  β”‚  Appointment     β”‚    β”‚  Appointment     β”‚         β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚
β”‚           β”‚                       β”‚                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”‚                    β”‚
β”‚  β”‚  Check Doctor    β”‚             β”‚                    β”‚
β”‚  β”‚  Availability    β”‚             β”‚                    β”‚
β”‚  β”‚  Β«includeΒ»       β”‚             β”‚                    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚                    β”‚
β”‚                                                        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚
β”‚  β”‚  View Medical    β”‚    β”‚  Prescribe       β”‚         β”‚
β”‚  β”‚  Records         β”‚    β”‚  Medication      β”‚         β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚
β”‚                                                        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚
β”‚  β”‚  Manage          β”‚    β”‚  View            β”‚         β”‚
β”‚  β”‚  Appointments    β”‚    β”‚  Reports         β”‚         β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚
β”‚                                                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β–²            β–²              β–²            β–²
     β”‚            β”‚              β”‚            β”‚
  β”Œβ”€β”€β”΄β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”
  β”‚Patientβ”‚  β”‚ Doctor   β”‚  β”‚  Admin  β”‚  β”‚System   β”‚
  β””β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚(Timer)  β”‚
                                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Writing Use Case Descriptions

For each use case in your diagram, write a detailed textual description. This is where the real value lies β€” the diagram is just an overview; the text captures the behavior.

Use Case: Make Appointment
────────────────────────────────────
Primary Actor: Patient
Scope: Hospital Appointment System
Level: User Goal

Preconditions:
  β€’ Patient is logged into the system
  β€’ At least one doctor is available in the system

Main Success Scenario:
  1. Patient selects "Make Appointment"
  2. System displays available departments
  3. Patient selects a department
  4. System shows doctors in that department with their schedules
  5. Patient selects a doctor and preferred time slot
  6. System checks doctor availability
  7. System confirms the appointment
  8. System displays appointment confirmation with details
  9. System sends confirmation SMS/email to patient

Extensions:
  5a. No available slots in desired timeframe:
      β†’ System suggests next available slots
      β†’ Patient can accept or choose a different doctor

  6a. Doctor becomes unavailable between selection and confirmation:
      β†’ System shows error and asks patient to select again

  7a. System fails to create appointment:
      β†’ System logs error and displays retry message

πŸ§ͺ Quick Quiz

Who or what interacts with the system in a use case diagram?