Use case models
Use case models capture who (actors) interacts with a system and what goals (use cases) they achieve; they are used for requirements capture, communication with stakeholders, and guiding design and testing.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Use case models record the external behaviour of a system as goals that users or external systems want to achieve. Engineers use them during requirements analysis, to communicate with stakeholders, to plan tests, and as input to class, sequence and activity models in later design stages.
Key ideas
System boundary — A named rectangle that encloses the use cases and shows what is inside (the system) vs outside (actors). Everything inside the rectangle represents behaviour provided by the system.
Scenario — One particular sequence of steps (one path) through a use case. The Main success scenario (also called basic flow) is the scenario where nothing goes wrong and the actor’s goal is achieved.
Alternate flow (extension) — A scenario that differs from the main success scenario because of conditions, errors, or optional behaviour; it can return to the main flow or end separately.
Precondition — A condition that must be true before a use case starts. Postcondition — A condition that is true after the use case completes (whether success or failure), often expressed as guarantees.
Trigger — The event that starts the use case (actor action or timed event).
Include relationship — A directed relationship used when several use cases share the same behaviour. Exact rule used in modelling: the base use case has a dashed line labeled <<include>> pointing to the included use case; the included use case represents behaviour that is factored out and always executed as part of the base use case. Use include for mandatory reuse of behaviour.
Extend relationship — A directed relationship used to show optional or conditional behaviour that extends the base use case at specified extension points. Exact rule used in modelling: the extension use case has a dashed line labeled <<extend>> pointing to the base use case; the base defines extension points where the extension may insert behaviour.
Generalisation (specialisation) — A relationship between actors or between use cases where a child inherits the behaviour of a parent. Draw a solid line with a hollow triangle arrowhead pointing to the parent (common behaviour is in the parent).
Rules and assumptions you must state in an exam answer:
- A use case must be named with a clear goal phrase (for example, "Withdraw Cash") and should represent a complete goal from an actor’s point of view. 2) Use cases are described in two complementary ways: a diagram (summary) and a textual description (template with preconditions, trigger, main scenario, alternate flows, postconditions). 3) Use case diagrams are not sequence diagrams: they show relationships and responsibilities, not step-by-step timing or message passing.
How to derive use cases from requirements (step-by-step method universities expect):
- List stakeholders. 2) For each stakeholder, list goals (what they want the system to do for them). 3) Remove low-level actions (turn these into steps inside use cases, not separate use cases). 4) Create one use case per goal. 5) Identify common behaviour to factor out with <<include>>. 6) Identify optional or conditional behaviour to model with <<extend>> and extension points. 7) Write textual use case descriptions for the most important use cases and validate with stakeholders.
What to draw in a use case diagram (exact drawing instructions for an exam):
- Draw a rectangle and write the system name at the top (this is the system boundary). 2) Inside the rectangle draw ovals for each use case; label each oval with the use case name. 3) Outside the rectangle draw stick-figure actors; label each actor. 4) Draw solid lines (associations) between actors and the use cases they initiate or participate in. 5) For <<include>> or <<extend>> draw dashed arrows between use case ovals and label them with the stereotype
<<include>>or<<extend>>; draw a solid line with hollow triangle for generalisation pointing to the parent. 6) Add notes or constraints if needed.
- Draw a rectangle and write the system name at the top (this is the system boundary). 2) Inside the rectangle draw ovals for each use case; label each oval with the use case name. 3) Outside the rectangle draw stick-figure actors; label each actor. 4) Draw solid lines (associations) between actors and the use cases they initiate or participate in. 5) For <<include>> or <<extend>> draw dashed arrows between use case ovals and label them with the stereotype
Formulas
For use case models, remember these syntaxes and templates:
Use Case: <Name> — name must express a goal.
Primary Actor: <actor name> — the actor who initiates the use case.
Stakeholders and Interests: — stakeholders affected by this use case.
Preconditions: <conditions> — what must be true before start.
Trigger: <event> — the event that starts the use case.
Main Success Scenario: — numbered step-by-step actions between actor and system.
Extensions/Alternate Flows: — list of alternative numbered scenarios and their return points.
Extension Points: <name> — named locations in the base use case where extensions may insert behaviour.
Postconditions: <guarantees> — what the system guarantees after completion.
<<include>> — dashed arrow from base use case to included use case (used for mandatory reuse).
<<extend>> — dashed arrow from extension use case to base use case (used for optional/conditional behaviour).
Generalisation — solid line with hollow triangle arrow pointing to parent use case or parent actor.
Association — solid line between actor and use case.
Worked examples
Example 1 — ATM: Withdraw Cash (diagram + textual use case)
- Identify actors: Customer (primary), Bank (external system for account validation). 2) Candidate goals: Withdraw Cash, Check Balance, Deposit Cash. 3) Use cases inside system boundary labelled: "Withdraw Cash", "Authenticate Card/PIN" (this could be a separate use case included by all account operations). 4) Common behaviour: Authentication is common to withdrawals and balance checks, so factor into an included use case. Textual use case (Withdraw Cash):
- Use Case: Withdraw Cash
- Primary Actor: Customer
- Preconditions: ATM online
- Trigger: Customer inserts card
- Main Success Scenario:
- System executes Authenticate (<<include>>) to verify card and PIN with Bank.
- Customer selects Withdraw Cash, amount, and account.
- System checks available balance with Bank.
- System dispenses cash and prints receipt.
- System updates account balance and logs transaction.
- Extensions:
1a. Authentication fails -> allow PIN re-entry up to three times; on failure, eject card and end use case.
3a. Insufficient funds -> show error and offer different amount; Return to step 2.
Postconditions: Cash dispensed and account debited.
Diagram instructions: Draw system boundary labeled "ATM System". Inside draw ovals "Withdraw Cash", "Authenticate"; draw actor stick figure "Customer" left outside with association to "Withdraw Cash" only (do not associate actors directly to included use cases that cannot be initiated on their own). Draw dashed arrow
<<include>>from "Withdraw Cash" to "Authenticate". Draw stick figure "Bank" right outside and an association from "Authenticate" to "Bank" (or show as external subsystem). Final check: include relationship from base (Withdraw Cash) to included (Authenticate). Final summary: The diagram shows actors Customer and Bank, use cases Withdraw Cash and Authenticate, and an <<include>> from Withdraw Cash to Authenticate. This models authentication as mandatory reuse.
Example 2 — Online Shopping: Checkout with optional Gift Wrap
- Actors: Customer (primary), Payment Gateway (external). 2) Use cases: Browse Items, Add to Cart, Checkout. Optional behaviour: Gift Wrap is optional during Checkout — model as an extension. Textual snippet for Checkout:
- Use Case: Checkout
- Primary Actor: Customer
- Preconditions: Cart not empty, Customer authenticated
- Trigger: Customer chooses Checkout
- Main Success Scenario: actor provides shipping address, chooses payment method, payment processed, order confirmed.
- Extension: Gift Wrap — labelled
<<extend>>from Gift Wrap use case to Checkout at extension point "Select Options". The Gift Wrap use case only runs if the customer selects gift wrap. Diagram instructions: Draw system boundary "Online Shop"; inside draw ovals Checkout, Gift Wrap. Draw<<extend>>dashed arrow from Gift Wrap to Checkout at extension point "Select Options". Draw Customer actor linked to Checkout only (do not link directly to Gift Wrap, which is an extension). Draw Payment Gateway outside with association to Checkout. Final summary: Gift Wrap is modelled with <<extend>> because it is optional and conditional.
Example 3 — Library: Checkout and Renew with generalisation
- Actors: Member and Librarian (Librarian generalises Member if librarian can do everything a member does plus administrative tasks). 2) Use cases: Checkout Item, Renew Item. If Renew Item uses the same validation steps as Checkout, factor validation into an included use case "Verify Membership".
Diagram instructions: Actors: Member (stick figure) and Librarian (stick figure) with a generalisation arrow from Librarian to Member (triangle pointing to Member). Use cases inside: Checkout Item, Renew Item, Verify Membership. Draw
<<include>>arrows from Checkout Item and Renew Item to Verify Membership. Final summary: Use generalisation when one actor is a specialised version of another, and include to share mandatory behaviour.
Common mistakes
- Wrong arrow directions for <<include>> and <<extend>> (explain and verify in review).
- Showing internal architecture or data flow in a use case diagram — use cases model behaviour visible to actors only.
- Forgetting to write textual descriptions for important use cases — diagrams alone are not enough in exams.
- Modeling optional behaviour with <<include>> instead of <<extend>> (include is for mandatory reuse).
For your exam
Question types you will see: definition, short-note, diagram-draw, derive/use-case-identification from a requirement paragraph, and full textual use case write-up. What a full-marks answer includes:
- For definitions: concise definitions for use case, actor, include, extend, and system boundary.
- For diagrams: a clean use case diagram with system boundary, labelled actors, ovals for use cases, associations, correctly labelled
<<include>>/<<extend>>/generalisation arrows, and a short legend if space permits. Describe what each element means in one line. - For derivation tasks: show the step-by-step method used to extract actors and goals (list stakeholders, goals, filter low-level actions), and produce a candidate diagram plus 1–2 textual use cases with preconditions, trigger, main scenario, and extensions.
- For textual use case questions: use the template shown in Formulas and include pre/postconditions, main success scenario with numbered steps, and alternate flows with clear return points.
Quick check
- What is the primary difference between
<<include>>and<<extend>>? - Where should actors be drawn in relation to the system boundary rectangle?
- Give three fields that must appear in a textual use case template.
Answers: 1)
<<include>>is for mandatory reuse (included use case always runs);<<extend>>is for optional/conditional behaviour inserted at extension points. 2) Actors are drawn outside the system boundary. 3) Primary Actor, Main Success Scenario (numbered steps), Preconditions (also acceptable: Trigger or Postconditions).
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?