Writing the Specification
Week 4 · Requirements as the Contract, part 2
Week 4 · Requirements as the Contract, part 2
The unit your agent builds against
flowchart LR BO["BO-PERF-instructor-efficiency"] --> FEAT["FEAT-performance-tracking"] FEAT --> WAR["Area: WAR"] FEAT --> EVA["Area: EVA"] EVA --> UC["UC-EVA-submit-evaluation"] UC -.-> LATER["Design, code, test: week 8"]
Every arrow is a link you can follow, forward and backward. That is traceability.
| Feature | Business objectives | Use case areas |
|---|---|---|
FEAT-performance-tracking |
BO-PERF-instructor-efficiency, BO-PERF-student-participation |
WAR, EVA |
| Shopper | The System | Fulfillment System | Billing System |
| a person | the online store | ships the order | charges the card |
| Actors | Shopper, Fulfillment System, Billing System |
| Trigger | The Shopper indicates to order the selected items. |
| Precondition | The Shopper has selected the items. |
| Postconditions | Placed, with a tracking ID and a delivery date. Or not placed, and the database is consistent. |
Step 6 already issued a tracking ID. Step 7 already told the Fulfillment System. What does cancelling have to undo?
The system's behavior under various conditions, as it responds to a request from one of the stakeholders, called the primary actor.
Use cases are fundamentally a text form. You just performed one.
Ask users what they do, not what features they want.
Users can review a use case, because it is written in the words of their business.
"As a student, I want to submit my weekly activity report, so that my instructor can see my work."
It builds what is written, and fills the gaps without asking.
Plan with user stories. Build against use cases.
The product owner told the agent, "we'll work out the details later." The agent shipped before later arrived.
Which of these are valid use cases?
| Test | Ask | Fails it |
|---|---|---|
| Boss | Is your boss happy you did this all day? | Log in |
| Elementary business process | One person, one sitting, a business event, value added? | Get a student loan: too big |
| Size | More than one step in a sequence? | Move a piece |
| Part | In Place an order |
|---|---|
| Primary actor: starts it, to reach a goal | The Shopper |
| Actors: anyone or anything with behavior | Fulfillment System, Billing System |
| Scope: the system under design | The online store |
| Pre- and postconditions | Items selected; placed, or database consistent |
| Main success scenario: nothing goes wrong | Steps 1 to 17 |
| Extension: a condition, then its handling | 10a, the Shopper cancels |


The goal is the belt. Each stripe is one scenario: success down one leg, failure down the other.
UC-<AREA>-<slug> identifierBR-* identifier onlyRobert Martin: "It shouldn't take longer than 15 minutes to teach someone how to write a use case." This lecture is fifty minutes. Writing a good one takes the rest of the semester.
Pause after each level. Each costs more than the last.
Place an order has plenty of interactions and two validations. Where is its internal change?
Subject ... verb ... direct object ... prepositional phrase.
The system ... deducts ... the amount ... from the account balance.
At every step one actor has the ball, and that actor is the subject of the sentence.
At the end of the sentence, who has the ball now?
"Kicked. Passed. Scored." Great match. Who won?
Not this
Get ATM card and PIN.
Deduct amount from account balance.
This
The customer puts in the ATM card and PIN.
The system deducts the amount from the account balance.
A main success scenario rarely needs more than nine steps.
Place an order had seventeen. Which would you merge?
Before
After
Requirements that mention the OK button are how a voice assistant ends up with an OK button.
Too much in one step
Split at the natural breaks
Before
After
The system checks whether the password is correct. The system is now very well informed, and nothing has happened.
Usually the timing is obvious. Say it only when the requirement depends on it.
Not good
User hits FETCH, at which time the system fetches the data from system B.
Better
Customer repeats steps 3-4 until indicating that they are done.
How many of the ten guidelines does this break?
System: Course Enrollment System · Goal level: User Goal
Extensions
An agent handed a use case with no extensions: "Understood. Nothing can go wrong."
Not this
Customer forgets PIN.
This
PIN entry time-out.
Invalid PIN · Network is down · The customer walked away (time-out) · Cash did not eject properly
The system has no sensor for regret.
Extensions
https://github.com/Washingtonwei/use-case-style-guide
Your use cases are reviewed against it. Give it to your agent when you ask for a review.
Project Pulse, UC-EVA-submit-evaluation (link in Slack)
What did you find that the agent missed? What did it find that you missed?
Where your review and the agent's disagree is where to look.
Use cases specify
What the system does, including when it fails.
They do not specify
Interfaces, data formats, business rules, formulas, constraints, quality attributes.
Everything a use case does not say
A senior manager gathered sixty employees for a day-long workshop on his company's next flagship product. Facilitators, brainstorming, ideas everywhere. He compiled it all into a hundred-page document and called it a requirements specification.
Nothing in it was classified, organized, or analyzed. The real requirements were in there somewhere. No developer could have found them.
Collecting is not specifying.
The functions the system must provide, its characteristics, and the constraints it must respect, described completely enough to say how the system behaves under various conditions, and how well.
docs/requirements/software-requirements-specification.md.docs/.| Reader | Takes |
|---|---|
| Project managers | Schedule, effort, resources |
| Developers | What to build |
| Testers | Test plans and procedures |
| Maintenance | What each part is supposed to do, years later |
| Doc writers | Manuals and help screens |
| Training | Course material |
| Legal | Whether it complies with the law |
The eighth reader is your agent, and it cannot walk down the hall. Good enough for a teammate is not good enough for an agent.
| Section | Holds | Lives |
|---|---|---|
| 2.4, 2.5 | Constraints; assumptions and dependencies | Here |
| 5.1 | Use cases | Link to use-cases.md |
| 5.2 | Requirements no use case contains | Here |
| 6 | Business rules | Link to business-rules.md |
| 7, 8 | Data; external interfaces | Here |
| 9 | Quality attributes | Here |
A fact in two documents means one of them is wrong, and it is the one you are reading.
CO-vue-spring-stack
The client in Vue.js. The backend in Java on Spring Boot.
CO-ferpa
Comply with FERPA when storing and transmitting student educational records.
Not a feature. It removes an option you would otherwise have had.
Who maintains this after you graduate, and what do they already know how to run?
Constraint discovered in week 14: the client's laptop cannot run Docker.
Project Pulse's specification lists DE-gmail-smtp: email notifications depend on the Gmail SMTP integration.
It does not list the assumption underneath: that mail from a Gmail sender reaches a TCU inbox. TCU's filter can junk it. That is why you were told to add the address to your safe senders, in a course where a late peer evaluation is not accepted.
An unwritten assumption fails exactly like a written one. Nobody planned for it.
Dependency
DE-llm-service: the AI features depend on an external LLM service.
AVL-llm-degradation: while it is down, everything else keeps working.
Risk
RI-scalability: heavy use in large capstone programs may stress the infrastructure.
SCA-cohort-load: about 70 students, up to 100 concurrent editors.
A risk ends in a requirement that mitigates it, or in an acceptance with a reason.
FR-NOT-weekly-reminder
On a course section's weekly due day for activity reports or peer evaluations, the system shall email each student in that section a reminder listing what is due and when.
No student asked for it. It is still a requirement.
| Shape | Opens with |
|---|---|
| Ubiquitous | The <system> shall <response> |
| Event driven | When <trigger> |
| State driven | While <in a state> |
| Optional | Where <feature is included> |
| Unwanted behavior | If <precondition>, then |
The shape teams skip: If.
Jackie, a chemist, needs more phosgene for her dyes. The chemical tracking system will not accept her request, so she calls Tim, the product owner.
Tim: Contoso requires an annual refresher class in the safe handling of hazardous chemicals. Corporate policy, based on OSHA regulations. The system just enforces it.
Is that a requirement of the software?
BR-evaluation-submission-window
A student may submit a peer evaluation only for the previous week, and has that one week to complete it. Later edits included.
The course's rule.
Project Pulse enforces it. Change the policy and the software is wrong.
The rule existed before the software, and survives the software being switched off.
OPEN-ISSUES.md entry."Must comply with all applicable regulations." Which ones? "The applicable ones."
A requirement document's status is DRAFT, SUBMITTED, RETURNED, or ACCEPTED.
Submitted goes to returned or accepted. Accepted is read-only.
Invented precision: a plausible field list reads exactly like a real one.
One team's ground software reported thruster impulse in pound-force seconds. The navigation software, built by another team, expected newton-seconds, as the interface specification required.
Every trajectory correction was off by a factor of 4.45. The spacecraft flew too low into the Martian atmosphere. A $327.6 million mission was gone.
Each side worked. The failure was in the space between them.
SI-llm-proxy-only
The browser never calls the LLM service directly, only through the server's AI proxy.
SI-import-allowlist
Uploads accept PDF and PowerPoint, up to 25 MB by default. Nothing else.
Hardware interfaces: "No hardware interfaces have been identified." That sentence is information.
Clarice is teaching in the new training room. She calls Sam, the maintenance supervisor: is the heating broken?
Sam: it is working normally. The right airflow, temperature held within half a degree from 60 to 85, every programming feature requested. Nobody said anything about noise, so I bought the cheapest unit that met the requirements.
Every requirement met. Room unusable.
What they say
"The dashboard should be fast."
PER-report-load
Return the dashboard and report views within 500 ms at the 95th percentile, under the load of SCA-cohort-load.
A number and a way to measure it.
Ask an agent for quality attributes and you get 99.9% uptime and a 200 ms response. Plausible, well-formed, conventional, traceable to nothing.
There is no fourth source.
OPEN-ISSUES.md entry, or gets deleted.business-rules.md, one owns constraints and quality attributes.docs/traceability.md, with their checks.