Use cases and use case diagrams
Actor, use case, system boundary, and the include, extend and generalization relationships. On the exam a scenario is given and you are asked to extract the actors and use cases and draw the diagram.
The use case model is the start of functional modeling: it shows what users want to do with the system. The diagram itself is simple (stick figures, ovals, lines), but marks are lost on the exam precisely over details: mixing up include and extend, drawing the arrow the wrong way, making a step into a use case, mistaking data for an actor. A typical exam question: a paragraph scenario is given and you are told “Identify the actors and use cases and draw the use case diagram”.
Golden rules:
- An actor is a role, outside the system. It can be a person, an external system or time.
- A use case is a goal that gives value to the actor. Its name is verb + object: “Book Class”.
- Include is mandatory, extend is conditional. The include arrow goes from the base to the included one, the extend arrow from the extending one to the base.
- Generalization is a solid line with a triangle head, from the bottom to the top.
Basic elements
| Element | Notation | Meaning |
|---|---|---|
| Actor | Stick figure (or an <<actor>> box) | A role interacting with the system |
| Use case | Oval, with a name inside | A goal for the actor |
| System boundary | Rectangle, with the system name on top | Scope |
| Association | Solid line (actor - use case) | The actor takes part in this use case |
| Include | Dashed arrow, <<include>> | Mandatory shared part |
| Extend | Dashed arrow, <<extend>> | Conditional additional behavior |
| Generalization | Solid line, hollow triangle head | “Is a kind of” relationship |
Actor
An actor is a role outside the system that exchanges information with it. Three points to watch on the exam:
- A role, not a person. Not “Professor Ahmet” but “Instructor”.
- External systems are actors. The payment provider, the university’s student information system.
- Time can be an actor. The “Time” actor that starts automatic jobs such as “generate a report at the end of every month”.
A primary actor is the actor that starts the use case and gets value from it. A secondary (supporting) actor is the actor from which the system gets help to do the job (e.g. Payment Service).
Use case
A use case is a complete goal that the actor accomplishes with the system and at the end of which they can say “I’m done”. Check questions:
- Does it give the actor a valuable result?
- Is it completed in a single session (in one go)?
- Is it in the actor’s language or in technical language?
Good: “Reserve Book”, “Pay Fine”, “Track Order”. Bad: “Login Screen” (a screen), “Validate Input” (a step), “Database” (a technology).
Relationships
Association
The solid line between an actor and a use case. It shows that the actor takes part in this use case. An arrowhead is not required. Optionally, multiplicity can be written.
Include
The shared behavior that several use cases need every time is extracted into a separate use case. The base use case cannot be completed without the included one.
(Book Class) - - <<include>> - -> (Verify Membership)
(Check In) - - <<include>> - -> (Verify Membership)
Extend
Behavior added to the base use case only under a certain condition. The base use case can also be completed without the extension. The extension point can be named inside the base use case.
(Pay Reactivation Fee)
- - <<extend>> - -> (Renew Membership)
condition: membership ended more than 30 days ago
PITFALL · arrow directions. Include: “Book Class includes Verify Membership” → the arrow leaves Book Class. Extend: “Pay Reactivation Fee extends Renew Membership” → the arrow leaves Pay Reactivation Fee. Form the sentence, and the arrow starts at the subject.
Generalization
Actor generalization: The child actor inherits all the relationships of the parent actor. Front Desk Staff and Trainer are special cases of Staff.
Use case generalization: Special kinds of a use case. “Pay Fee” is general, “Pay by Card” and “Pay by Cash” are subtypes.
Front Desk Staff ---|> Staff
Trainer ---|> Staff
(Pay by Card) ---|> (Pay Fee)
Here ---|> represents a solid line with a hollow triangle head.
Comparing include, extend, generalization
| Include | Extend | Generalization | |
|---|---|---|---|
| When it runs | Always | When the condition holds | The subtype takes the place of the supertype |
| Is the base use case complete on its own | No | Yes | The supertype may be abstract |
| Arrow direction | Base → included | Extending → base | Child → parent |
| Line | Dashed, open arrow | Dashed, open arrow | Solid, hollow triangle |
Worked example: the FitHub gym
Scenario: “A person becomes a member at the reception through a front desk staff member. Members renew their membership online; if the membership ended more than 30 days ago, they pay a reactivation fee. Payments are taken through an external payment service. Members reserve places in group classes and cancel their reservations. They check in at the turnstile when entering the gym. For reservation and check-in, the membership is verified to be active every time. Trainers manage the class schedule. At the end of every month the system automatically generates a monthly report and sends it to the managers. Front desk staff and trainers share common tasks as staff.”
Step 1: Find the actors. Scan the nouns, select the roles that interact with the system.
| Candidate | An actor? | Why |
|---|---|---|
| Person / Member | Yes: Member | Role |
| Front desk staff | Yes: Front Desk Staff | Role |
| Trainer | Yes: Trainer | Role |
| Staff | Yes: Staff (parent actor) | Shared role |
| Payment service | Yes: Payment Service | External system |
| End of month | Yes: Time | A job triggered by time |
| Turnstile | No (in this solution) | Counted as part of the system |
| Class schedule, report | No | Data |
Step 2: Find the use cases. Scan the verbs.
| Use case | Primary actor | Note |
|---|---|---|
| Register Member | Front Desk Staff | |
| Renew Membership | Member | Payment Service secondary |
| Pay Reactivation Fee | (extend) | Conditional |
| Book Class | Member | |
| Cancel Booking | Member | |
| Check In | Member | |
| Verify Membership | (include) | Shared mandatory |
| Manage Class Schedule | Trainer | |
| Generate Monthly Report | Time |
Step 3: The diagram.
+------- FitHub Membership System ---------+
| |
| (Register Member) |
| (Renew Membership)<-<<ext>>-(Pay React. |
| | Fee) |
| (Book Class)--<<inc>>-->(Verify |
| (Check In)----<<inc>>--> Membership) |
| (Cancel Booking) |
| (Manage Class Schedule) |
| (Generate Monthly Report) |
+------------------------------------------+
Associations (from outside):
Member ......... Renew, Book, Cancel, Check In
FrontDeskStaff . Register Member
Trainer ........ Manage Class Schedule
Payment Service Renew Membership
Time ........... Generate Monthly Report
Generalization:
Front Desk Staff --|> Staff
Trainer --|> Staff
Step 4: Check.
- Is every actor connected to at least one use case? Yes. (Staff is a parent actor; if a shared use case is added, e.g. “View Member Profile”, it is connected to that.)
- Is every use case reached by an actor or linked by include/extend? Yes.
- There are 9 use cases inside the boundary. That is at the limit of readability; in a larger system it is divided into packages.
Where do use cases come from?
Use cases are derived from the functional requirements you gathered in week 5. Every functional requirement must be traceable to at least one use case (traceability). Nonfunctional requirements do not appear in the diagram; they are written in the “special requirements” part of the relevant use case description (week 7).
Common mistakes
| Wrong idea | The truth |
|---|---|
| An actor is a specific person | It is a role; one person can play several roles |
| A database or a report is an actor | It is data, inside the system |
| Include is conditional | Include always runs; the conditional one is extend |
| The extend arrow leaves the base | The extend arrow goes from the extending one to the base |
| Every screen or step is a use case | A use case is a complete goal; steps go in the description |
| Ordering use cases with arrows (first login then …) | A use case diagram shows no order; order is in the activity/sequence diagram |
| Drawing the actor inside the boundary | An actor is always outside |
| The generalization arrow from top to bottom | From bottom to top, with the hollow triangle at the supertype |
Test yourself
Exam-style questions. Solve them on paper first, then reveal the answer.
In a use case diagram, what does an actor represent?
- A specific person, e.g., 'Ayşe'
- A role played by a person, a system or time that interacts with the system
- A class in the design
- A screen of the application
Show answer
An actor is a role, not a person. The same person can be both a Member and Staff. External systems (Payment Service) and time (Time, for automatic monthly jobs) can also be actors. An actor is always outside the system boundary.
Food-delivery app: 'A customer browses restaurants and places an order. The customer pays online through an external payment gateway. A courier accepts a delivery and marks it delivered. Restaurant staff update the menu.' List the actors.
Show answer
Human roles: Customer, Courier, Restaurant Staff. External system: Payment Gateway (a secondary actor, the system uses it). "Restaurant" and "menu" are not actors; they are data or concepts inside the system.
For the same food-delivery scenario, list the use cases.
Show answer
A use case name is verb + object: a valuable result the actor gets from the system. Six use cases come out. If Pay Online is a mandatory part of Place Order, it can be linked with <<include>>; Payment Gateway is connected to Pay Online.
Both 'Book Class' and 'Check In' always need to verify that the membership is active. Which relationship models this?
- Extend
- Include
- Generalization
- Association
Show answer
The shared behavior that several use cases use every time (mandatorily) is extracted as a separate use case and linked with <<include>>: Book Class → Verify Membership, Check In → Verify Membership.
In an extend relationship, which way does the arrow point?
- From the base use case to the extending use case
- From the extending use case to the base use case
- From the actor to the use case
- There is no arrow
Show answer
The <<extend>> arrow goes from the extending (optional) use case to the base use case: Pay Late Fee - - -> Renew Membership. <<include>>, in contrast, goes from the base to the included one. Both are dashed arrows.
'When renewing, if the membership expired more than 30 days ago, the member must also pay a reactivation fee.' Model the reactivation fee.
Show answer
The behavior runs only when a condition arises: extend. The base use case (Renew Membership) can be completed even without this addition. The condition can be written as a note together with the extension point.
Front Desk Staff and Trainer can both 'View Member Profile', and Trainers can also 'Create Workout Plan'. How can you simplify the diagram?
Show answer
Actor generalization: the child actor inherits all the use cases of the parent actor. The arrow is a solid line with a hollow triangle head, from the child actor to the parent actor. That way one line is drawn to View Member Profile instead of two separate lines.
Which is a BAD use case name?
- Reserve Book
- Pay Fine
- Database Update
- Return Book
Show answer
A use case is a valuable goal for the actor and is named in the actor's language with verb + object. "Database Update" is an internal technical operation, not a goal for the student. It is also a noun pattern, not a verb.
In the gym diagram on this page, how many use cases are inside the system boundary?
Show answer
Register Member, Renew Membership, Pay Reactivation Fee, Book Class, Cancel Booking, Check In, Verify Membership, Manage Class Schedule, Generate Monthly Report. Total 9. The actors (Member, Staff, Front Desk Staff, Trainer, Payment Service, Time) are outside the boundary and are not counted.
Why is 'Enter Password' usually not modeled as a separate use case?
Show answer
A use case diagram shows high-level goals. Steps like "enter password" or "press the button" are steps of the use case description. A diagram divided too finely (functional decomposition) becomes unreadable. Rule: the actor should be able to say "I'm done" when this use case ends.
What does the system boundary rectangle show?
Show answer
The system boundary (subject) draws the scope: what is inside is the functions we will develop, what is outside is the interacting roles. The name of the boundary is the name of the system (e.g. 'FitHub Membership System').
Verification: Conceptual and 'identify' questions; the actor/use case lists and relationship types were checked one by one against the UML 2 use case diagram rules (include: mandatory shared behavior, arrow from the base use case to the included one; extend: conditional behavior, arrow from the extending one to the base; generalization: hollow triangle from the subtype to the supertype). Counting questions were counted by hand on the diagram on the page and compared twice.