Functional and non-functional requirements
What you will learn on this page
Section titled “What you will learn on this page”- The difference between a functional requirement, a non-functional requirement, and a constraint.
- How to write a functional requirement that a test can check.
- How to replace vague quality words (“fast”, “secure”, “scalable”) with a measure, a threshold, and a condition.
- How to keep design decisions out of requirements, and why.
From answers to requirements
Section titled “From answers to requirements”The question log from the clarification lesson holds answers, in the words people used. That is not yet something you can design against or test. “500 pages per person per calendar month” says what the limit is, but not what the system must do when a job reaches it. A requirement is a numbered, checkable statement of what the system must do, or how well it must do it, with a link to where it came from.
There are three kinds of statement to separate:
| Kind | Says | Print-release example |
|---|---|---|
| Functional requirement | What the system does: a behaviour, for an input or event | A user can release their held jobs at any printer by badging in. |
| Non-functional requirement | How well it does it, or under what conditions | Printing starts within 10 seconds of badging in, for 95% of releases. |
| Constraint | A fixed limit on the solution, decided by someone else | Jobs arrive only through the existing print server. |
A test for a functional requirement checks a result: did the job print? A check for a non-functional requirement usually measures a quantity: how long did it take, how many jobs could it hold? A constraint is not tested so much as respected: a design that bypasses the print server is not a design for this office.
The naive version
Section titled “The naive version”Here is a requirement list that looks complete and is almost useless:
- Users can print their documents securely.
- The system should be fast.
- It should be easy to use.
- Quotas should be enforced.
- It must be reliable and scalable.
What is wrong with it:
- Nothing can be tested. How fast is “fast”? A tester and a developer can disagree about whether item 2 is met, and both be right.
- Several things per item. Item 5 is two qualities; item 1 is a behaviour and a quality.
- No behaviour at the edges. Item 4 says quotas are enforced, but not what happens to a job that does not fit (Q9 answered that; the list lost it).
- No sources. Nobody can tell which item came from the facilities manager and which from a guess.
Writing functional requirements
Section titled “Writing functional requirements”A useful functional requirement has these properties:
- One behaviour. If it has “and” between two behaviours, split it.
- Observable. It describes something a user, another system, or a test can see: a job printed, a message shown, a job deleted.
- Precise at the edges. It says what happens at the limit, not just in the normal case.
- Free of design. It says what, not how. “Held jobs are stored in a
std::vector” is a design decision, not a requirement. - Traced to a source. Each one names the question, scope item, or goal it came from.
A simple pattern helps: [who or what] must [do what], [when or under which condition]. Here are the print-release service’s functional requirements:
| ID | Requirement | Source |
|---|---|---|
| FR-1 | The service must hold every job the print server reports, and must not print a job until it is released. | S1, G2 |
| FR-2 | A user must be able to release their held jobs at any printer in the building by badging in at it. | S2, Q4, Q5 |
| FR-3 | Released jobs must print at the printer where they were released, oldest first. | S2 |
| FR-4 | A released job must print only if all its pages fit in the owner’s remaining monthly quota; otherwise it is not printed, and the panel says why. | S4, Q7, Q9 |
| FR-5 | Facilities must be able to grant a user extra pages for the current month. | S4, S6, Q9 |
| FR-6 | Facilities must be able to set a user’s monthly quota; the default is 500 pages. | S6, Q7 |
| FR-7 | A job held for 24 hours must be deleted, and can then no longer be released. | S3, Q10 |
| FR-8 | Badging in must release only the jobs of the badge’s owner. | G2 |
| FR-9 | If a printer jams or goes offline during a job, the pages not yet printed must not be lost; the user can release them again. | S5, Q15 |
Notice what the table does and does not say. FR-1 has an “and”, but it is one behaviour seen from two sides (held, therefore not printed), so it stays together. FR-4 states the edge (a job that does not fit is not printed) in the same sentence as the rule. FR-9 says what must not be lost but not how the service knows which pages were printed; that depends on Q16, still open, and the requirement should not pretend otherwise. FR-8 came from a goal, not from an answer: nobody said it, but G2 makes no sense without it.
Writing the list also surfaces questions. FR-4 says “the panel says why”, but does a refused job stay held? The use-case lesson meets that question (Q20) and records an assumption.
Writing non-functional requirements
Section titled “Writing non-functional requirements”Non-functional requirements describe qualities: speed, capacity, security, availability, durability, how easy it is to change. They are often stated with words that feel precise and are not:
| Vague word | The question to ask |
|---|---|
| fast, quickly, responsive | How long, measured from when to when, and how often must it be met? |
| scalable, handles lots | How many of what, at the peak, and with what margin? |
| secure | Against whom, protecting what, and what must never happen? |
| reliable, robust | Which failures, how often, and what must happen when they occur? |
| easy to use, user-friendly | Which task, by whom, in how many steps or how much time? |
| flexible, configurable | What is expected to change, and who must be able to change it? |
| real-time, immediately | Within what time? (Often “soon enough that nobody notices”.) |
A measurable non-functional requirement has four parts:
- The quality being described: response time, capacity, durability.
- The measure: seconds, jobs, percentage of requests.
- The threshold: “within 10 seconds”, “at least 500”.
- The condition: when, for which operations, under what load, measured where.
Here are the print-release service’s non-functional requirements:
| ID | Quality | Requirement | Source |
|---|---|---|---|
| NFR-1 | Response time | From the moment the service receives a badge read until it hands the first job to the print server: at most 10 seconds for 95% of releases in a working day, and never more than 30 seconds. | Q14, Q18 |
| NFR-2 | Capacity | The service must hold at least 2,000 jobs at once, and accept at least 500 new jobs in one hour, while meeting NFR-1. | Derived from Q12 (assumption) |
| NFR-3 | Security | A held job can be released only by its owner’s badge at a printer. There is no other way to release it: no PIN, no web or phone release. | G2, Q17, X4 |
| NFR-4 | Durability | Held jobs and quota balances must survive a restart of the service. | Q19 (assumption) |
| NFR-5 | Changeability | Facilities must be able to change the default quota and the expiry time without a new release of the software; a change applies from the next day at the latest. | S6, Q8 |
Each row is worth a closer look.
NFR-1 started as “within 10 seconds” (Q14). Making it measurable raised two new questions. Every time, or nearly every time? The facilities manager said nearly every time (Q18), so the threshold is 95%. The 30-second ceiling is a proposal, labelled as an assumption until confirmed. Measured from where? The time a user waits includes the badge reader, the network, the print server, and the printer warming up. The service controls only its own part, so the requirement measures from “badge read received” to “job handed to the print server”. The rest is outside the boundary, and is the print server’s business.
NFR-2 is derived. Q12 estimated about 1,000 jobs a day, mostly between 9:00 and 11:00. If most of them arrive in those two hours, the peak is several hundred jobs an hour, and jobs held overnight can pile up. The numbers 2,000 and 500 add a margin over the estimate. They are only as good as Q12, which is an assumption, so the requirement says so. Note the order of magnitude: these are small numbers for a single C++ program, and no part of this design needs to be distributed to meet them.
NFR-3 shows that a security requirement often becomes a statement of what must never happen, plus functional requirements that make it true (FR-2, FR-8). It also turns exclusion X4 into a rule.
NFR-4 came from a question that nobody had asked: “After a power cut, must held jobs still be there?” Losing held jobs means people print again, which works against G3; losing quota balances would reset everyone’s limit. The answer is not confirmed yet (Q19), so the requirement is marked as an assumption, and it is a costly one: it means storing jobs and balances durably.
NFR-5 came from likely changes. Facilities sets limits (Q3), and the colour question (Q8) is open, so the quota rules will change. Saying so in a requirement makes it a design input, not a surprise.
How the non-functional requirements shape the design
Section titled “How the non-functional requirements shape the design”Even at the level of classes, these numbers matter:
- NFR-1 means the release must not wait forever for the badge system: the badge lookup needs a time limit. Ten seconds is long for a computer, so the release logic itself can be simple.
- NFR-2 means a plain container of held jobs, searched in order, is more than fast enough for 2,000 jobs. No index or database query tuning is needed to meet it.
- NFR-4 means held jobs and quotas must be saved somewhere outside the process. In the design, that becomes an interface for storage, so the release logic does not depend on how saving is done.
- NFR-5 means the quota and expiry values are data, read at run time, not constants in the code. (The use-case lesson’s small example keeps them as constants, and says so.)
The quality-constraints lesson goes further into how such requirements change local design.
Constraints
Section titled “Constraints”A constraint is a limit on the solution that the designers do not get to choose. For the print-release service:
| ID | Constraint | Source |
|---|---|---|
| C-1 | Jobs arrive only through the existing print server, which also sends pages to printers. | Q1, X5 |
| C-2 | Users are identified only through the existing badge system. | Q5, X6 |
| C-3 | The service runs on a server that IT already operates. | IT (Q3) |
Constraints are useful because they remove options. C-1 means the service never needs to render a page. But they should be checked like any other answer: a constraint that turns out to be only a preference (“we usually use this server”) may be negotiable, and knowing that can open a simpler design.
When the distinction does not matter much
Section titled “When the distinction does not matter much”The line between functional and non-functional is not always sharp. “Only the badge’s owner’s jobs are released” (FR-8) is a behaviour, and also a security quality. Do not spend time arguing about the label. What matters is that each requirement is testable, traced, and in the list. The labels help mainly as a reminder to ask about qualities, which requests usually leave out.
When not to add numbers
Section titled “When not to add numbers”- When nobody needs the number. Inventing “99.99% availability” for a service whose users can walk to another printer adds cost and no value. Ask what happens if the service is unavailable for an hour; if the answer is “people wait”, say that instead.
- When the number is a guess dressed up as a fact. A derived number should say what it was derived from, as NFR-2 does.
- When the quality is not a concern at all. Not every system needs a capacity requirement. Say so in one line, so the omission is visibly deliberate.
Trade-offs
Section titled “Trade-offs”Precise requirements take longer to write and can cause arguments that vague ones avoid. That is the point: the argument happens now, between people, rather than later, in a bug report. The cost is that precise numbers become commitments. A threshold set too strictly (every release in 2 seconds) can force a much more complex design than the problem needs, so ask what the number is for before tightening it.
Common mistakes
Section titled “Common mistakes”- Vague quality words with no measure. “Fast”, “secure”, “scalable”.
- Measuring what you do not control. A response-time requirement that includes the printer’s warm-up time cannot be met by any design of the service.
- Requirements that describe the design, such as data structures or class names.
- Only the normal case. “Quotas are enforced” without saying what happens at the limit.
- Losing the source. A requirement without a source cannot be questioned, and cannot be dropped when its reason goes away.
- Treating assumptions as requirements. NFR-2 and NFR-4 rest on assumptions; the list says so.
When a requirement changes
Section titled “When a requirement changes”Two months after launch, the facilities manager reports: “People say printing is slow.” That is a vague quality word, arriving as a complaint. Before changing anything:
- Ask what “slow” means. Slow to start after badging? Slow to print a long job? Slow only at 9:30?
- Measure against NFR-1. If the service hands jobs to the print server within 10 seconds 95% of the time, the service meets its requirement, and the delay is elsewhere (the print server or the printers, outside the boundary).
- If the requirement itself is wrong, rewrite it with the facilities manager: perhaps 5 seconds is now needed. That is a requirement change, with a new source, and NFR-1’s tests or measurements change with it.
Because NFR-1 says where it is measured, the complaint can be investigated rather than argued about.
Exercise: Rewrite vague requirements as testable ones
Rewrite each requirement so that it can be checked. Where you need a number or a rule that you do not know, write the question you would ask and a labelled assumption.
- “The system should be fast.”
- “Users should be able to easily find their jobs.”
- “The service must be secure.”
- “It should handle lots of jobs.”
- “Quotas should be flexible.”
- “Printing should be reliable.”
Show the explained answer
Many good rewrites exist. These are examples, with what each one fixes:
- “Fast” → “From receiving a badge read to handing the first job to the print server: at most 10 seconds for 95% of releases.” The quality is response time; the threshold, percentage, and the start and end points are explicit. If you did not know the number, the question is “How long can a user wait at the printer before it feels broken?”
- “Easily find their jobs” → “After badging in, the printer’s panel lists the user’s held jobs, oldest first, with each job’s document name and page count.” This makes “easy” a concrete behaviour. Ask: “What do people need to see to recognise their job?”
- “Secure” → “A held job can be released only by its owner’s badge at a printer; no other release method exists.” and “Held jobs are deleted after 24 hours.” Security splits into specific things that must never happen, each of which can be tested. Ask: “What must never happen to a confidential document?”
- “Lots of jobs” → “The service holds at least 2,000 jobs at once and accepts at least 500 new jobs an hour, while meeting the response-time requirement.” State what the numbers are derived from (here, the estimate of about 1,000 jobs a day) and label them as assumptions if the estimate is.
- “Flexible quotas” → “Facilities can change any user’s monthly quota and grant extra pages for the current month, without a software release; a change applies from the next day at the latest.” “Flexible” becomes a list of who can change what. Ask: “Which quota rules do you expect to change, and who changes them?”
- “Reliable” → split by failure: “If a printer jams during a job, the pages not printed remain available to release again.” and “Held jobs survive a restart of the service.” “Reliable” means nothing until you say which failures and what must happen. Ask: “What has gone wrong with printing before, and what did it cost?”
Check your answers against the four parts: is there a quality, a measure, a threshold, and a condition? For functional rewrites (2, 3, 5, 6), is there one observable behaviour per sentence? And did you avoid naming a data structure or class?
Summary
Section titled “Summary”- Functional requirements say what the system does; non-functional requirements say how well, or under what conditions; constraints are limits on the solution set by others.
- A good functional requirement describes one observable behaviour, including its edges, without design, and names its source.
- A good non-functional requirement replaces vague words with a quality, a measure, a threshold, and a condition, measured at a point the system controls.
- Derived numbers and assumptions are labelled as such.
- Writing requirements precisely surfaces new questions; add them to the question log.