Learn

Architecture & pattern guides

Read the idea, build it on a Grid, prove it in a challenge. Short, practical guides — illustrated with RodGrid's own nodes — on system design, design patterns, flow modeling, and how to get the most out of the app.

All articles

Use cases, actors and the system boundary

Deciding what the system is responsible for and what it merely talks to: actors outside, use cases named as goals inside, the boundary between them, and the include and extend arrows. The diagram to draw first when the scope is in doubt.

An argument about one email

A public library's system is getting overdue notices, and two developers disagree before anyone has drawn anything. One says the email provider sends them: its servers are what put the message in the member's inbox. The other says the library system sends them: it knows whose book is past its date, and it decides tonight's list. Neither is wrong about what happens. They are arguing about where a line goes, and that line is what a use-case diagram is for.

A use-case diagram has three parts: actors outside, use cases inside, and the system boundary that separates them. Its value is almost entirely in that line, because it forces you to say what the system is responsible for and what it merely talks to.

Whose problem is a missing notice?

Settle the argument by asking who has to act when it goes wrong. A member three weeks late received nothing. If the nightly list left her out, the library's team fixes it. If the provider's servers were down, the library's team still owes her a notice, so they retry or change provider. The provider answers for the messages it accepted, and knows nothing about books. So "Send overdue notice" goes inside the boundary, and the provider stands outside as a system that use case relies on.

A library, scoped

The librarian, the member and the email provider are outside the boundary, and so is any other system the library depends on.

That line is a decision. If the city ran a central reminders service that took loan dates from the library, chose whom to chase and answered for delivery, the same email would sit outside this boundary, and a late notice would be that team's to fix. Either drawing can be right. Leave it undecided and each team assumes the other has it.

Outside is not the same as human

An actor is any role outside the boundary, and it need not be a person: a payment provider, a scheduler, another service are all actors. The nightly job and the payment provider are the ones people forget to design for, and then nobody has asked what happens when one fails. A job outside the boundary that triggers a use case is an actor; a timer inside it is just how a use case gets started, whoever's platform it runs on.

The opposite surprise is the librarian. She works for the library, so someone puts her inside. But the boundary goes around the software, which is why it is named for the library system, and she uses that system. Anything inside is part of the system and cannot also be a user of it.

A goal the member would recognise

A use case is named as a goal the actor has, in the actor's words: "Borrow a book", not "Insert loan row". If the name contains a table or a screen, it is probably a step.

The overdue notice shows the usual slide. "Find late loans", "Build the email" and "Call the provider" all sound reasonable, and drawing them turns the diagram into a flowchart. They are steps of one goal. Steps belong in a sequence or flow diagram, and the order of the calls between the library system and the provider is a job for Sequence diagrams: who calls whom, in what order. How many notices go out a night is for Back-of-envelope estimation, and how well the system must do this for the requirements step of Approaching a system design problem.

NoteWhen the scope is in doubt, draw this one first. Correcting the boundary here is cheap; correcting it later means reworking the classes, sequences and states that depend on what you decided the system is for.

Lines, and the two dashed arrows

Draw a line only where that actor actually takes part in the use case: as the one who starts it, as a system it relies on (the bank, the payment provider), or as the one who receives its result, like the member with her notice. The empty spaces are information. The librarian has no line to "Reserve a title" because in this library members reserve for themselves. Connect every actor to every use case and that fact disappears.

Sharing is the other thing lines have to say. Borrowing and reserving both check that the membership is valid, and repeating that in each is how the two copies drift apart, so it becomes a use case of its own, even though nobody comes to the library just to check a membership: being shared is what earns a step that place. «include» means the base case always runs it: the dashed arrow goes from the base case to the included one, from "Borrow a book" to "Check membership". «extend» means optional behaviour that adds to a base case only under a condition: the arrow goes from the extension to the base, from "Pay a fine" to "Return a book", because only a late return calls for it.

The directions look inconsistent until you ask which case knows about the other. The arrow starts at the one that knows. "Borrow a book" cannot finish without the membership check, and the check knows nothing about borrowing. "Return a book" is complete without a fine, and the fine is the one that knows where it attaches. An ATM has both shapes if every transaction has to authenticate: each one includes Authenticate, and Print receipt extends Withdraw cash. If one login covers a whole session, being authenticated can be a precondition instead.

NoteOn a Challenge Grid the System Boundary is a node, not a box drawn around the use cases, and arrows cannot be dashed. Name the boundary for the system (ATM), connect each actor only to the use cases it takes part in, and write «include» or «extend» in the label of a connection between two use cases.

The same argument at a cash machine

In ATM Use Cases, put the bank outside the boundary, as an actor. It is the email provider's argument again: the accounts are the bank's, and the boundary is the ATM's alone. Then check that every use case inside is a goal a cardholder would recognise. If one reads like a database operation, rename it or drop it.

Library Use Cases goes back to this library. Its brief adds the overdue notice, sent by the system on a schedule, and asks you to connect the actor who receives it; before you do, work out why that actor stands outside the line.

Practice this