Archyno
UMLBehaviour diagrams

UML use case diagrams

The diagram for scope, not design. Who uses the system, what they use it for, and where the boundary of the thing you are building actually sits - drawn before a single class exists.

13 min readUML 2.5.111 of 35

The short answer

  • A use case diagram is a map of scope: who interacts with the system, what goals they come with, and where the line between inside and outside falls.
  • A use case is a goal that delivers something an actor values, not a step or a screen. Actors are roles, and they always sit outside the boundary.
  • «include» points from the base to behaviour that always runs; «extend» points from the optional extra back to the base. The directions are opposite and this is what people get wrong.
  • The diagram is the table of contents. The deliverable is the use case description behind each ellipse - primary actor, preconditions, main success scenario, extensions, postconditions.
UML use case diagram. A Merchant actor sits outside a Checkout system boundary and is associated with three use cases: submit payment, authorize payment, and refund payment. Submit payment and refund payment each include authorize payment. Log audit trail extends refund payment. Authorize payment is associated with a Fraud service, a secondary actor on the right.
A use case diagram for a checkout system. The rectangle is the system boundary: everything inside is yours to build, everything outside is somebody you talk to.

01What it shows, and what it deliberately does not#

A use case diagram is a map of scope. It names the people and systems that interact with what you are building, the goals they come to it with, and the line between inside and outside. That is all it does, and its restraint is the point.

It says nothing about order. Nothing about screens, fields, or algorithms. Nothing about how anything works. Every one of those is a different diagram, and the temptation to smuggle them onto this one is what produces the sprawling, useless use case diagrams that gave the notation a bad reputation.

02Finding the actors and the use cases#

Nobody hands you a list. The diagram above looks obvious once drawn and was not obvious at all beforehand, and the gap between a blank page and that picture is four questions you can ask in a room in twenty minutes.

  1. Who starts something here?Every one of them is a candidate primary actor. Ask for the role rather than the name - the person who said "I do that" is one holder of a role that will outlast them.
  2. Who or what receives something without asking? Reports, files, notifications, settlement runs. These are the supporting actors on the right-hand side of the boundary, and they are the half of the diagram most first drafts miss.
  3. What has to be there for this to work? Payment providers, identity services, the mainframe, a fraud engine. Anything you would raise a ticket with another team about is outside the boundary and belongs on the diagram - drawing it is often the moment somebody realises the dependency was never agreed.
  4. What happens because time passed? A nightly reconciliation, a fourteen-day expiry, a monthly invoice run. Time is an actor, drawn as a stick figure labelled Clock or Scheduler, and processes that leave it off end up with use cases nobody appears to start.

Then name each goal from the actor's side of the counter, verb first, in their vocabulary: Submit payment, not Payment submission handling and certainly not PaymentController. If the name only makes sense to somebody who has seen the code, it is a step in a use case rather than a use case.

03The four marks#

ElementNotationWhat it means
Actorstick figureA role outside the system - a person, another system, or a clock. A role, not a named individual: Merchant, never Anna.
Use caseellipseA goal the system delivers, named verb-first.
System boundaryrectangleThe subject. Use cases go inside it, actors always outside. Its name is the thing you are building.
AssociationThis actor participates in this use case. No arrowhead needed.
IncludeDashed arrow from the base to the included case. The included behaviour always runs.
ExtendDashed arrow from the extension to the base. The behaviour runs only sometimes.
GeneralizationHollow triangle at the general one. Works between actors and between use cases.

04Include and extend, without the confusion#

These two are the reason use case diagrams get drawn wrong. Both are dashed arrows with a keyword, and they point in opposite directions.

«include» points from the base to the thing it always does. Read it as "calls". In the diagram above, Submit payment includes Authorize payment: you cannot submit without authorizing. It exists to factor out behaviour shared by several use cases - which is exactly why Refund payment includes it too.

«extend» points from the optional extra back to the base. Read it as "may interrupt". Log audit trail extends Refund payment: refunds work without it, and it happens under some condition. The base use case does not know its extensions exist.

Actor generalization. A Merchant admin actor and a Merchant staff actor both point with hollow triangles at a general Merchant user actor, meaning each is a kind of merchant user.
Generalization works on actors too. Both specific roles point at the general one, meaning each can do everything a merchant user can.

05Behind the bubble: the use case description#

The diagram is the table of contents. The thing that gets built from is the use case description behind each ellipse - and a project that draws the diagram and never writes the descriptions has produced a picture of work rather than a specification of it. This is the part the notation says nothing about, which is why so many teams stop at the picture.

There are three useful depths, and choosing one is a project decision rather than a modelling one. A brief description is two sentences in the backlog. A casual one is a paragraph per scenario. A fully dressed one has the fields below, and is worth the effort for the handful of use cases that carry real money or real risk.

  • Name. The ellipse's label, verb first: Authorize payment.
  • Primary actor. Whoever wants the result. Merchant.
  • Stakeholders and interests. Who else cares and what they need out of it. The acquirer wants a valid authorization code; the fraud team wants the attempt recorded whether it succeeds or not. This field is where most missed requirements turn up.
  • Preconditions. What is already true before the use case starts - the merchant is authenticated, the order exists. Not a list of steps, a list of guarantees.
  • Main success scenario. The numbered happy path, actor step then system step, in the language of the business. Somewhere between five and twelve steps; more than that and the use case is really two.
  • Extensions. Numbered against the step they branch from - 4a, 4b, 7a - each with its condition and what happens. This is the field that actually earns the format, because it is a systematic prompt for every way the happy path fails.
  • Postconditions.What is true afterwards, on success and on each failure. "An authorization is recorded and the funds are held" is testable in a way that "the payment is processed" is not.

Worked small, for Authorize payment: the main success scenario is (1) the merchant submits the payment, (2) the system validates the order total, (3) the system requests authorization from the acquirer, (4) the acquirer returns an approval, (5) the system records the hold and confirms. The extensions are where the work is - 3a the acquirer times out, 4a the acquirer declines, 4b the acquirer requests a step-up challenge - and each of those is a conversation somebody would otherwise have had six weeks later in a defect triage.

06When to draw one#

Reach for it when

  • Agreeing scope at the start of a project, with people who do not read code
  • Working out which external systems you actually depend on
  • Producing a checklist that a test plan or a backlog can be derived from
  • Showing that a requirement belongs to somebody else's system, not yours

Reach for something else when

  • You want to show a sequence of steps - that is an activity or sequence diagram
  • The system has one actor and four use cases; a bulleted list is clearer
  • You are tempted to decompose use cases into sub-use-cases three levels deep
  • The audience is engineers who need the design, not the scope

A useful use case diagram fits on one page and has somewhere between three and ten ellipses. It is a table of contents, not the book. The detail belongs in use case descriptions - the numbered main flow and its alternatives - or, if the flow is branchy enough to be worth drawing, in an activity diagram per use case.

07Common mistakes#

  1. Functional decomposition. Twenty ellipses named after buttons. Use cases are goals; if it is not something an actor wants, it does not belong.
  2. Actors named after people or job titles in your org chart. Model the role. One person can be several actors, and one actor can be a batch job.
  3. «include» and «extend» arrows reversed. They point opposite ways. Apply the removal test above.
  4. Actors inside the boundary. The boundary is what you are building. An actor is by definition outside it.
  5. Sequencing implied by vertical position. A use case diagram has no time axis. Nothing about the layout says what happens first.

In one line each

  1. 01Use case diagrams answer who and what for - never how or in what order.
  2. 02A use case is a goal that delivers value to an actor, named verb-first.
  3. 03Actors are roles and always sit outside the boundary rectangle.
  4. 04«include» points from the base to behaviour that always runs.
  5. 05«extend» points from the optional extra back to the base.
  6. 06Three to ten use cases on one page; the detail lives in descriptions, not on the canvas.

08Common questions#

What is the difference between include and extend?

Include means the base use case always runs the included one, so it is factored-out behaviour, and the arrow points from base to included. Extend means the extending use case runs only under a condition, and the arrow points the other way, from the extension to the base. The direction is the part people most often get backwards.

What is an actor in a use case diagram?

Anything outside the system that interacts with it: a person in a role, another system, or a scheduled trigger. An actor is a role rather than an individual, so one person may be two actors and one actor may be many people.

What should not go in a use case diagram?

Sequence, data and design. A use case diagram answers who uses this and what for, not in what order or with which fields. If you find yourself drawing steps, you want an activity diagram.

What is the system boundary box for?

The rectangle around the use cases marks what you are building. Actors sit outside it and use cases inside. It is the element that turns the diagram into a statement about scope, which is the main reason to draw one at all.

What goes into a use case description?

A fully dressed one has a name, the primary actor, the stakeholders and what each needs, preconditions, a numbered main success scenario, extensions numbered against the step they branch from, and postconditions. The extensions field is the one that earns the format, because it is a systematic prompt for every way the happy path can fail.

In this series

Related reading

All articles