Quality Attributes, Functional & Non-Functional Requirements
"The quality of a system is the degree to which the system satisfies the stated and implied needs of its various stakeholders, and thus provides value." — ISO/IEC 25010 quality model, as quoted on the ISO/IEC 25000 portal (iso25000.com)
Summary: a requirement says either what the system does (functional) or how well, how fast, how safely and how cheaply it does it (quality attributes, usually called non-functional requirements). The second kind decides the architecture, and it only helps when it is written as a measurable scenario and checked by an automatic test. Focus: functional versus non-functional versus constraint, the ISO/IEC 25010:2023 model with every sub-characteristic, quality attribute scenarios, latency percentiles, availability nines, RPO and RTO, SLI, SLO and error budgets, trade-offs, utility trees and ATAM, fitness functions, requirements smells, user stories, use cases, job stories and Gherkin, with Go and Laravel tests. Learning goal: take a vague sentence such as "the checkout must be fast and reliable", turn it into measured scenarios with owners and budgets, decide which quality wins when two collide, and encode each number as a test that fails the build.
This page is the complete reference for the first design question: what must the system be good at? It covers where the vocabulary comes from (McCall, Boehm, ISO 9126, ISO 25010, the SEI scenario template, ATAM, evolutionary architecture), every term practitioners use, how to write and verify measurable requirements, and how the same requirement changes meaning when the system grows from one process to many services. It does not re-teach its neighbours: the split between architecture and design is on Software Architecture vs Software Design, the step-by-step design workflow is on The Design Process, coupling and cohesion as design-level quality are on Design Quality, network latency and partial failure are on Distribution of Components, retries and circuit breakers are on Error Handling & Fault Tolerance, and threat modelling is on Security by Design.
Page map
| If you are looking for | Go to |
|---|---|
| The whole topic in a few tables | Everything in one minute |
| Why quality requirements exist and what they trade | Why it exists |
| McCall, Boehm, ISO 9126, ISO 25010, SEI, ATAM, Ford | Where it comes from |
| Functional vs non-functional vs constraint | FR vs NFR, Constraints |
| Every ISO/IEC 25010:2023 characteristic and sub-characteristic | The 25010 model |
| Source, stimulus, artifact, environment, response, measure | Quality attribute scenario |
| p95, p99, nines, RPO, RTO, throughput, capacity | Measurable NFRs |
| SLI, SLO, SLA, error budget | SLI, SLO, SLA and error budget |
| Performance vs maintainability, security vs usability, consistency vs availability | Trade-off pairs |
| Utility tree, ATAM, risks, sensitivity points | Prioritising |
| Fitness functions | Fitness functions |
| Vague, unverifiable, solution-in-requirement | Requirements smells |
| User story, use case, job story, acceptance criteria, Gherkin | Stories and use cases, Acceptance criteria |
| NFR as a test in Go and Laravel | Go, Laravel |
| Monolith, microservices, distributed | In architecture |
| A complete requirements document | Worked example |
| Wrong beliefs, cheat sheet, self-check, every term | Misconceptions, Cheat sheet, Self-check, Glossary |
Everything in one minute
The three kinds of "must". Every row is unpacked in the concepts section.
| Kind | In plain words | Tiny example | If you get it wrong |
|---|---|---|---|
| Functional requirement (FR) | What the system does | "A shopper can pay for a cart" | Wrong product |
| Quality attribute / non-functional requirement (NFR) | How well it does it | "95% of payments finish in under 300 ms" | Right product that is slow, fragile or insecure |
| Constraint | A decision already made for you | "Must run on our existing PostgreSQL 16 cluster" | Rework, legal trouble, rejected release |
The quality vocabulary in one table.
| Term | In plain words | Tiny example | What goes wrong without it |
|---|---|---|---|
| Quality attribute | A property such as speed, safety or changeability | Availability | Teams argue about adjectives |
| Quality attribute scenario | One measurable story about a quality | "Node crashes at peak, traffic recovers in 30 s" | "Make it reliable" |
| Response measure | The number that judges the response | p95 under 300 ms | Nobody can say pass or fail |
| SLI | A measured indicator | Share of requests under 300 ms | Opinions instead of data |
| SLO | Target for an SLI over a window | 99.9% over 30 days | Endless reliability work or none |
| SLA | SLO with a contract and a penalty | Refund if under 99.5% | Surprise bills |
| Error budget | Allowed unreliability: 100% minus the SLO | 43 minutes per 30 days at 99.9% | Releases blocked by fear |
| RPO / RTO | Data you may lose / time to be back | RPO 5 min, RTO 30 min | Backups that nobody can restore in time |
| Utility tree | Tree from "quality" down to concrete, ranked scenarios | Performance, then Latency, then the p95 scenario | Gold-plating every attribute |
| Fitness function | An automatic check that an architectural property still holds | CI fails if domain imports net/http | Slow erosion nobody notices |
Availability in nines (30-day month, full outage time you may spend):
| Target | Nines | Per 30 days | Per year |
|---|---|---|---|
| 99% | two | 7 h 12 min | 3 d 15 h 36 min |
| 99.9% | three | 43 min 12 s | 8 h 45 min 36 s |
| 99.95% | three and a half | 21 min 36 s | 4 h 22 min 48 s |
| 99.99% | four | 4 min 19 s | 52 min 34 s |
| 99.999% | five | 26 s | 5 min 15 s |
Why it exists
A system is judged by two questions: does it do the right things, and does it do them well enough? The first is easy to see in a demo. The second only shows up on the worst day: the sale, the outage, the audit, the year-three change request. Quality attribute requirements make that worst day a design input instead of a surprise. They also expose the fact that qualities fight each other, so someone must choose before the code exists.
| Without explicit quality requirements | With measured quality requirements |
|---|---|
| "Fast" means whatever the loudest person feels | "Fast" is p95 under 300 ms at 200 requests per second |
| Architecture is chosen by fashion | Architecture is chosen by the ranked scenarios it must satisfy |
| Conflicts surface in production | Conflicts surface in a workshop, with a record of who chose what |
| Tests check behaviour only | Tests also check latency, structure and recovery |
| Cheap to write down | Costs a few hours of discussion per attribute |
| Risk: the system passes every demo and fails the first Monday | Risk: over-specifying qualities nobody needs (gold plating) |
The picture is the six-part scenario you will use throughout: a source sends a stimulus to an artifact that is in some environment; the artifact responds; a response measure says whether that was good enough. Every quality requirement on this page can be drawn this way.
The analogy we reuse on this page: building a house. The floor plan lists the rooms: a kitchen, two bedrooms. That is the functional requirement. "The walls must keep the noise from the road below 35 dB", "the roof must carry snow", "the extension must be possible without moving the staircase" are quality attributes; they decide the walls, the beams and where the staircase goes, and they are expensive to change after the walls are up. "Must be built on this plot, under the city's height limit" is a constraint: nobody negotiates it with the architect.
Three common misunderstandings, up front
- "Non-functional means optional or secondary." It means "not a function". Missing latency or security makes the product unusable, however many functions it has.
- "Quality attributes are a checklist to tick." They are in tension. You choose a few that win, state numbers for them, and accept that others lose.
- "We will tune performance at the end." Performance, availability and security are mostly decided by structure: where the network is, where the data lives, who trusts whom. The end is too late to change those.
Where it comes from
McCall, 1977, and Boehm, 1978. The first quality trees came from US defence-funded studies: Jim McCall's factors (correctness, reliability, efficiency, integrity, usability, maintainability, flexibility, testability, portability, reusability, interoperability) and Barry Boehm's software quality characteristics tree. We did not read these originals; they are cited here from the standard secondary literature, and the ISO models below descend from them.
ISO/IEC 9126, 2001, and ISO/IEC 25010, 2011. The ISO 9126 model (functionality, reliability, usability, efficiency, maintainability, portability) was replaced by the SQuaRE series. ISO/IEC 25010:2011 split quality into product quality (eight characteristics) and quality in use. The iso25000.com portal, which mirrors the standard's text, defines the purpose of the model:
"The quality model determines which quality characteristics will be taken into account when evaluating the properties of a software product." — ISO/IEC 25000 portal, page on ISO/IEC 25010
ISO/IEC 25010:2023. The current edition has nine characteristics. Compared with 2011, usability became interaction capability, portability became flexibility (and now holds scalability), and safety is new. Within security, resistance is new; within reliability, maturity became faultlessness. The page we read (iso25000.com, which republishes the model; the standard itself is paid and the iso.org page returned HTTP 403) lists only the 2023 structure, so the 2011 comparison is from the widely documented change list, not from that page.
Bass, Clements and Kazman. Software Architecture in Practice (2nd edition, 2003) argues that attribute definitions are not operational: "It is meaningless to say that a system will be modifiable. Every system is modifiable with respect to one set of changes and not modifiable with respect to another." Its fix is the six-part scenario:
"A quality attribute scenario is a quality-attribute-specific requirement. It consists of six parts." — Bass, Clements, Kazman, Software Architecture in Practice, 2nd ed., section 4.3 (chapter text as hosted by UBC course pages)
Kazman, Klein, Clements, 2000. The SEI technical report ATAM: Method for Architecture Evaluation (CMU/SEI-2000-TR-004) adds the utility tree and the evaluation workshop:
"Utility trees provide a top-down mechanism for directly and efficiently translating the business drivers of a system into concrete quality attribute scenarios." — Kazman, Klein, Clements, CMU/SEI-2000-TR-004, section 5.3
Ford, Parsons and Kua, 2017. Building Evolutionary Architectures introduced fitness functions. Thoughtworks summarises the idea:
"Fitness functions describe how close an architecture is to achieving an architectural aim." — Thoughtworks, Fitness function-driven development
Google SRE, 2016. The SRE book gives the operational vocabulary: SLI, SLO, SLA and error budget.
The concepts, one by one
Each block follows the same order: plain words, the usual wrong belief, a precise definition, a timeline, real scenarios, what product or tool provides it, and the fix.
Functional vs non-functional requirements Must-know
In plain words: a functional requirement is a thing the system does (send an invoice); a non-functional requirement is a quality of how it does anything (the invoice arrives within a minute, only the customer can read it, we can change the template in a day).
Common misunderstanding: "Non-functional requirements are separate from features, so a separate team or phase can handle them." The same sentence often contains both. "The system sends the invoice within one minute" is a function with a quality; the quality will shape queues, retries and capacity, so it belongs in the feature's acceptance criteria, not in a later hardening phase.
Definition: Wikipedia (secondary source) defines an NFR as "a requirement that specifies criteria that can be used to judge the operation of a system, rather than specific behaviours", contrasted with functional requirements "that define specific behavior or functions". The same article notes the alternative names cross-functional requirements and, in architecture, architectural characteristics. Many authors dislike the word "non-functional" and prefer quality requirements; this page uses both.
Sentence Parts
1 "Users can export their orders as CSV." FR
2 "Export of 100,000 rows finishes in 20 s (p95)." NFR (time behaviour) attached to FR 1
3 "Only the order owner can export." FR or NFR (confidentiality)? both; test it as a behaviour
4 "Exports must be written to the EU bucket." constraint (legal)Real scenarios: an export button that works and times out for large customers; a login that works and leaks account existence through error messages; a search that works and cannot be changed without a rewrite.
| Question to classify a sentence | If yes |
|---|---|
| Can I demo it with one request and one answer? | Mostly functional |
| Does it need a number, a load, a failure or a time period to judge? | Quality attribute |
| Did someone outside the team already decide it? | Constraint |
| Would the answer change if hardware, load or attackers changed? | Quality attribute |
Fix: write every FR with its quality in the same acceptance criteria, and move system-wide qualities (availability, retention, audit) to a short list of scenarios that every feature inherits.
The ISO/IEC 25010:2023 product quality model Must-know
In plain words: ISO's checklist of nine qualities a software product can have, each with named parts, so you do not forget one and so two teams mean the same thing by "reliability".
Common misunderstanding: "ISO 25010 says what to build." It is a vocabulary and a measurement frame. It tells you which qualities exist; you still decide which three matter for your product and how to measure them.
Definition: product quality is the degree to which the system satisfies stated and implied needs. The model has nine characteristics and, in the portal's listing, 40 sub-characteristics. The definitions below are paraphrased from the portal text we read; the standard itself is paid.
| Characteristic | Sub-characteristic | In plain words | Example check |
|---|---|---|---|
| 1. Functional suitability | Functional completeness | The functions cover all the tasks and goals users have | Every user story in the release exists |
| 1. Functional suitability | Functional correctness | Results are accurate | Tax computed to the cent |
| 1. Functional suitability | Functional appropriateness | Functions help to do the task without detours | Checkout in 3 steps, not 9 |
| 2. Performance efficiency | Time behaviour | Response time and throughput meet requirements | p95 under 300 ms |
| 2. Performance efficiency | Resource utilization | CPU, memory, storage, network, energy used stay within need | Under 2 GB RSS per pod |
| 2. Performance efficiency | Capacity | Maximum limits (users, records, volume) meet requirements | 5 million orders per table |
| 3. Compatibility | Co-existence | Works next to other products sharing the environment without harming them | Does not starve the co-located cron job |
| 3. Compatibility | Interoperability | Can exchange information with other systems and use it | Reads the partner's OpenAPI feed |
| 4. Interaction capability | Appropriateness recognizability | Users can tell whether it fits their need | Landing page states the purpose |
| 4. Interaction capability | Learnability | Learnt within a stated time | New agent productive in 2 hours |
| 4. Interaction capability | Operability | Easy to operate and control | Keyboard shortcuts for frequent actions |
| 4. Interaction capability | User error protection | Prevents users from making operation errors | Confirmation before deleting a project |
| 4. Interaction capability | User engagement | The interface is inviting and encourages continued use | Clear progress feedback |
| 4. Interaction capability | Inclusivity | Usable by people of various backgrounds, abilities, languages | Right-to-left layout, screen reader labels |
| 4. Interaction capability | User assistance | Usable by the widest range of capabilities to reach goals | Large-text mode, captions |
| 4. Interaction capability | Self-descriptiveness | Shows the right information so use is obvious without manuals | Field help beside the input |
| 5. Reliability | Faultlessness | Performs without fault under normal operation | Zero defects in the nightly run |
| 5. Reliability | Availability | Operational and accessible when needed | 99.9% monthly |
| 5. Reliability | Fault tolerance | Keeps working despite hardware or software faults | One of three nodes can die |
| 5. Reliability | Recoverability | After a failure, recovers directly affected data and returns to the desired state | RPO 5 min, RTO 30 min |
| 6. Security | Confidentiality | Data accessible only to those authorised | No card number in logs |
| 6. Security | Integrity | State and data protected from unauthorised change or deletion | Signed webhooks, row-level audit |
| 6. Security | Non-repudiation | Actions can be proven to have happened | Signed approval records |
| 6. Security | Accountability | Actions traced uniquely to an entity | Per-user audit log |
| 6. Security | Authenticity | Identity of a subject or resource can be proven | MFA, mTLS |
| 6. Security | Resistance | Keeps operating while under attack | Rate limiting under a login flood |
| 7. Maintainability | Modularity | Parts are discrete, so one change hits few others | A change in billing touches only billing |
| 7. Maintainability | Reusability | An asset can be used in more than one system | Shared auth library |
| 7. Maintainability | Analysability | Impact of a change and causes of failure can be assessed | Traces link a request across services |
| 7. Maintainability | Modifiability | Can be changed without introducing defects or lowering quality | New tax rule in one day |
| 7. Maintainability | Testability | Test criteria can be set and checked | 90% of rules covered by fast unit tests |
| 8. Flexibility | Adaptability | Can be adapted to or moved to other hardware, software or environments | Runs on ARM and x86 |
| 8. Flexibility | Scalability | Handles growing or shrinking workloads or adapts capacity | Double traffic with double nodes |
| 8. Flexibility | Installability | Can be installed and uninstalled in a specified environment | One Helm chart |
| 8. Flexibility | Replaceability | Can replace another product for the same purpose in the same environment | Drop-in for the old queue |
| 9. Safety | Operational constraint | Keeps operation within safe parameters when a hazard appears | Insulin pump caps dose |
| 9. Safety | Risk identification | Identifies event sequences that could endanger life, property or the environment | Detects sensor drift |
| 9. Safety | Fail safe | Switches itself to a safe mode on failure | Brakes lock on control loss |
| 9. Safety | Hazard warning | Warns of unacceptable risks in time to react | Alarm before overheating |
| 9. Safety | Safe integration | Maintains safety during and after integration with other components | Plugin cannot disable the interlock |
The diagram puts a few sub-characteristics on one line only to save space; in the table each is a row of its own. The count is 3 + 3 + 2 + 8 + 4 + 6 + 5 + 4 + 5 = 40.
Real scenarios: a payment API mostly needs reliability, security, performance efficiency; a design tool mostly interaction capability and compatibility; a medical device safety first; an internal reporting job maintainability and recoverability.
| Product type | Top three characteristics | Usually low priority |
|---|---|---|
| Payments API | Security, reliability, performance efficiency | Interaction capability beyond the dashboard |
| Mobile consumer app | Interaction capability, performance efficiency, flexibility | Non-repudiation |
| Data pipeline | Reliability (recoverability), maintainability, capacity | Inclusivity |
| Embedded medical | Safety, reliability, security | Scalability |
| Internal CRUD tool | Maintainability, functional suitability, installability | Resistance |
Fix: copy the table into a spreadsheet, mark each row "matters / does not matter / unknown" with the product owner, and write scenarios only for the "matters" rows.
Quality attribute scenario Must-know
In plain words: one sentence-sized story, "when this happens to that part of the system under these conditions, the system does this, and we judge it by that number".
Common misunderstanding: "A scenario is a user story for qualities." Not quite: a user story names a person and a benefit; a scenario names any source (a user, an attacker, a crashing node, a developer) and ends in a measurable response.
Definition: Bass, Clements and Kazman give six parts, and we quote their definitions (2nd ed., section 4.3):
| Part | Their wording | Typical values |
|---|---|---|
| Source of stimulus | "some entity (a human, a computer system, or any other actuator) that generated the stimulus" | Shopper, attacker, scheduler, failing disk, developer |
| Stimulus | "a condition that needs to be considered when it arrives at a system" | Request, crash, attack, change request |
| Environment | "The system may be in an overload condition or may be running when the stimulus occurs" | Normal, peak, degraded, startup, maintenance |
| Artifact | "Some artifact is stimulated. This may be the whole system or some pieces of it" | Service, database, queue, UI, build |
| Response | "the activity undertaken after the arrival of the stimulus" | Serve, fail over, reject, log, deploy |
| Response measure | "it should be measurable in some fashion so that the requirement can be tested" | Latency percentile, recovery time, effort in person-days |
The authors also separate general scenarios (system independent) from concrete scenarios (this system). Use general ones as prompts in a workshop, concrete ones in the requirements document.
Time Event Part
1 10:00 200 shoppers submit POST /orders source + stimulus
2 10:00 system at normal load, one replica degraded environment
3 10:00 checkout service stores the order, returns 201 artifact + response
4 10:05 p95 = 270 ms, p99 = 640 ms response measure: pass (limits 300/800)Real scenarios: six concrete scenarios across attributes:
| Attribute | Source | Stimulus | Artifact | Environment | Response | Measure |
|---|---|---|---|---|---|---|
| Performance (time behaviour) | 200 shoppers | POST /orders | Checkout service | Normal load | Order stored, 201 returned | p95 under 300 ms, p99 under 800 ms |
| Availability (fault tolerance) | Hardware | One of three app nodes dies | App tier | Peak load | Load balancer drains node, others serve | No more than 0.1% failed requests, recovery in 30 s |
| Recoverability | Operator error | DROP TABLE orders | Primary database | Business hours | Restore with point-in-time recovery | RPO 5 min, RTO 30 min |
| Security (integrity) | Attacker | Tampers with price in the request body | Checkout API | Normal | Server recomputes price, rejects mismatch | 100% of tampered requests rejected, audit entry written |
| Modifiability | Product manager | Add a new payment provider | Payment module | Development | New adapter added, no change to checkout core | Under 3 person-days, 0 changes outside payment/ |
| Testability | Developer | Runs unit tests on a laptop | Pricing rules | Development | Tests run without database | Suite under 20 s |
What provides it: the scenario itself is a document. The checking is done by tools: load tests (k6, Gatling, vegeta, Locust), chaos tools (Chaos Mesh, Litmus, AWS Fault Injection Service), static analysis (go-arch-lint, Deptrac, Pest arch tests), restore drills.
Fix: write the scenario first, then the test that can fail. See the Go and Laravel sections.
Measurable NFRs Must-know
In plain words: a quality counts as a requirement only when you can say which measurement would prove you wrong.
Common misunderstanding: "Average response time is a good performance requirement." Averages hide the slow tail. The Google SRE book states it directly: "We generally prefer to work with percentiles rather than the mean (arithmetic average) of a set of values." Its example: a typical request is served in about 50 ms while 5% of requests are 20 times slower, and an alert on the average would never fire.
Definition: the families of measures you will meet:
| Family | Measure | Notes |
|---|---|---|
| Latency | p50, p95, p99, p99.9 of response time | State the percentile, the window and where it is measured (client or server) |
| Throughput | Requests, messages, transactions per second | Pair with a latency limit; throughput alone can be met by queueing forever |
| Availability | Share of successful requests, or uptime share | "Nines"; define what counts as a failure |
| Error rate | Failed requests divided by all requests | HTTP 5xx, timeouts; decide whether 4xx counts |
| Durability | Probability data survives | RPO is the practical form |
| Recovery | RTO, MTTR, MTBF | RTO: time to be back; RPO: how much recent data you may lose |
| Capacity | Maximum users, rows, bytes before degradation | Test the cliff, not only the average |
| Efficiency | CPU, memory, I/O, cost per request | Ties NFRs to the cloud bill |
| Maintainability | Lead time for change, change failure rate, time to onboard | DORA-style delivery metrics are indirect proxies |
| Security | Time to patch criticals, share of endpoints with authz tests, MFA coverage | Pair with penetration-test findings |
| Term | Definition | Example |
|---|---|---|
| p95 | 95% of requests are at or below this latency | p95 = 300 ms: 1 in 20 may be slower |
| p99 | 99% at or below | Often 3 to 10 times p50 |
| RPO (Recovery Point Objective) | Maximum tolerable data loss, measured in time | 5 minutes of orders |
| RTO (Recovery Time Objective) | Maximum tolerable time to be back in service | 30 minutes |
| MTTR | Mean time to recover (or repair) | 20 minutes this quarter |
| MTBF | Mean time between failures | 90 days |
| Throughput | Work completed per unit of time | 800 orders per second |
| Concurrency | Work in flight at once | 400 open requests |
| Utilisation | Share of a resource in use | CPU 65% |
Two formulas make the numbers honest. Little's law: in a stable system, the average number of requests in flight equals the arrival rate times the average time each spends in the system (L = λ × W). With 800 requests per second and 250 ms each, about 200 are in flight, so a pool of 100 connections cannot hold. Tail amplification: if one call is slow 1% of the time and a page makes 100 independent calls, the chance that at least one is slow is 1 minus 0.99 to the 100th power, about 63%. That is why p99 of a dependency becomes p50 of the page.
Availability maths:
| Layout | Formula | Example |
|---|---|---|
| Serial (all must work) | a₁ × a₂ × … × aₙ | Three services at 99.9% each: 99.7% (about 2 h 10 min per month) |
| Parallel (any one works) | 1 − (1 − a)ⁿ | Two independent replicas at 99.9%: 99.9999% |
| Serial with parallel parts | Combine | Load balancer 99.99% × (two app nodes in parallel) × database 99.95% |
Parallel only holds if failures are independent. Two replicas in the same rack, on the same deploy, share fate.
Dependency chain per request Availability
1 gateway 99.99%
2 checkout service 99.9%
3 payments service 99.9%
4 inventory service 99.9%
5 ---------------------------------------------
6 product 0.9999 x 0.999^3 = 99.79% -> about 1.5 h of failures per 30 daysPostgreSQL percentile in SQL (works on a request log table; percentile_cont is an ordered-set aggregate in PostgreSQL):
-- p50, p95, p99 latency per route over the last hour
SELECT route,
percentile_cont(0.50) WITHIN GROUP (ORDER BY duration_ms) AS p50,
percentile_cont(0.95) WITHIN GROUP (ORDER BY duration_ms) AS p95,
percentile_cont(0.99) WITHIN GROUP (ORDER BY duration_ms) AS p99,
count(*) AS requests
FROM request_log
WHERE logged_at > now() - interval '1 hour'
GROUP BY route
ORDER BY p99 DESC;
-- availability SLI: share of non-5xx requests over 30 days
SELECT 1.0 - (count(*) FILTER (WHERE status >= 500))::numeric / count(*) AS availability
FROM request_log
WHERE logged_at > now() - interval '30 days';What provides it: Prometheus histograms (histogram_quantile), OpenTelemetry metrics, Datadog, Grafana, Laravel Pulse and Horizon for queue wait time. Percentiles cannot be averaged across hosts; aggregate buckets, not percentiles.
Fix: for each NFR write metric, percentile or ratio, window, load, where measured. A line missing one of those five is still a wish.
SLI, SLO, SLA and error budget Must-know
In plain words: the SLI is the thermometer, the SLO is the temperature you promise, the SLA is the contract with a refund, and the error budget is how much you are allowed to miss before you must stop shipping new things.
Common misunderstanding: "The SLO is 100% because every failure matters." 100% is not achievable, and it freezes delivery. The SRE book says in its risk chapter "100% is probably never the right reliability target: not only is it impossible to achieve, it's typically more reliability than a service's users want or notice", and states that "the error budget provides a clear, objective metric that determines how unreliable the service is allowed to be within a single quarter."
Definition: the SRE book chapter defines an SLO as "a target value or range of values for a service level that is measured by an SLI", and prefers explicit statements such as "99% (averaged over 1 minute) of Get RPC calls will complete in less than 100 ms (measured across all the backend servers)." The SLA is the contract around SLOs with consequences; the same chapter notes SREs do not usually construct SLAs because they are "closely tied to business and product decisions".
Quarter day Event Budget (SLO 99.9%, 1,000,000 requests/day expected)
1 day 1 Budget for 90 days = 0.1% of 90M = 90,000 failed requests
2 day 12 Bad deploy fails 40,000 requests remaining 50,000 (55%)
3 day 13 Policy: pause risky releases above 50% burn -> only fixes ship
4 day 40 Another incident spends 55,000 remaining -5,000: SLO missed
5 day 41 Freeze features until budget recovers or SLO is renegotiatedReal scenarios: a product team wants to ship twice a day; SRE says reliability is at 99.95% against a 99.9% target, so budget exists and the release goes ahead. A different quarter the budget is gone and the team spends the sprint on reliability.
| Item | Who owns it | Where it lives |
|---|---|---|
| SLI definition | Engineering and product | Monitoring config in git |
| SLO value | Product management with engineering | Service README, dashboards |
| SLA | Business, legal | Contract |
| Error budget policy | Engineering leadership | Team handbook, release tooling |
What provides it: Prometheus + Alertmanager multi-window burn-rate alerts, Sloth or Pyrra to generate SLO rules, Google Cloud Monitoring SLO service, Datadog SLOs, OpenSLO as a spec. Error budgets are a deep topic of their own; the SRE book chapters Service Level Objectives, Embracing Risk and the workbook's Implementing SLOs are the primary sources.
Fix: pick one availability SLI and one latency SLI per user journey, choose targets from what users tolerate and what you can afford, publish the budget, and write down what happens when it runs out. The Go function BudgetRemaining is in the snippets.
Trade-off pairs Must-know
In plain words: you cannot max out every quality at once. Making one better usually makes another worse, and the architect's job is to choose on purpose and write down why.
Common misunderstanding: "A good architecture satisfies all qualities." The ATAM report defines this precisely: "A tradeoff point is a property that affects more than one attribute and is a sensitivity point for more than one attribute", with the example that changing the level of encryption affects both security and performance. Good architecture picks which quality is sacrificed, knowingly.
Definition: a trade-off pair is two attributes where a decision that helps one tends to hurt the other.
| Pair | Why they collide | Decision that moves it | Where to pick the side |
|---|---|---|---|
| Performance vs maintainability | Hand-tuned hot paths, caches, denormalised data and inlined code are fast and hard to change | Caching layer, denormalising, custom serialisation | Optimise only the scenarios in the utility tree; keep a benchmark proving the need |
| Security vs usability | Each extra check (MFA, short sessions, strong passwords) adds friction | MFA policy, session lifetime, step-up authentication | Risk-based: strong for money movement, light for browsing |
| Consistency vs availability (during partitions) | If replicas cannot talk, you either refuse writes or accept divergence | Quorum settings, single-leader vs multi-leader | See Eventual Consistency in Databases and Replication & Failover |
| Consistency vs latency | Waiting for more replicas costs round trips | synchronous_commit, read quorum, read-your-writes routing | Per operation, not per system |
| Availability vs cost | Each extra nine needs redundancy | Multi-AZ, multi-region | SLO derived from business loss per hour |
| Flexibility vs performance | Generic layers add indirection | Plugin systems, ORMs, interpreters | Generic at the edge, specific in the hot path |
| Security vs performance | Encryption, hashing, validation cost CPU and time | TLS termination, hashing cost (bcrypt rounds, Argon2 memory) | Tune to the attack model |
| Modifiability vs time to market | Clean seams take longer now | Modular monolith vs a single file of scripts | Invest where change is expected |
| Scalability vs simplicity | Distribution adds failure modes | Microservices vs a monolith | Delay distribution until a scenario demands it |
| Testability vs encapsulation | Tests want hooks that production code should not expose | Interfaces, dependency injection | Test through public behaviour first |
Step Who Statement Quality moved
1 1 Product "Orders must never be lost" durability up
2 2 Architect Write to the database and the queue in one transaction (outbox) consistency up
3 3 Operations Outbox relay adds up to 200 ms delay time behaviour down
4 4 Workshop Accept 200 ms; record decision ADR-014 with the scenario trade-off recorded
5 5 CI Fitness test: p95 of "order accepted" under 300 ms guard addedReal scenarios: a bank forcing MFA on login (security up, conversion down) but not on balance view; a product page cached for 60 seconds (performance up, price correctness down); a social feed using eventual consistency (availability up, read-after-write down).
What provides it: Architecture Decision Records (Michael Nygard's format) record the choice; ATAM or a lightweight scenario review finds it early; the fitness functions below keep the winner winning.
Fix: for every pair that appears in your top scenarios, write one ADR: "We choose X over Y for scenario S; we accept losing Z; we revisit when W."
Prioritising: utility tree and ATAM Important
In plain words: a utility tree turns the vague root "utility" into branches (performance, availability, security, modifiability), then concrete scenarios, and marks each with two letters: how important it is to the business and how hard it is for the architecture. The scenarios that are important and hard get the design attention.
Common misunderstanding: "ATAM is a heavy, multi-week ceremony." The report describes a full evaluation with many stakeholders, but the core ideas (a utility tree, scenario ranking, naming risks and trade-off points) work in a two-hour whiteboard session for a single service.
Definition: in the ATAM report's sample tree each leaf carries a pair such as (H,M); the report's figure shows leaves like "Minimize storage latency on customer DB to 200 ms", "Power outage at Site 1 requires traffic re-direct to Site 2 in under 3 secs" and "Add CORBA middleware in under 20 person-months". Two mechanisms elicit scenarios: utility trees (top-down, a few architects) and facilitated brainstorming (bottom-up, all stakeholders).
The ATAM has nine steps in three phases. We read them from the report:
| Phase | Step | What happens |
|---|---|---|
| Presentation | 1 | Present the ATAM to stakeholders |
| Presentation | 2 | Present business drivers |
| Presentation | 3 | Present the architecture |
| Investigation and analysis | 4 | Identify architectural approaches |
| Investigation and analysis | 5 | Generate the quality attribute utility tree |
| Investigation and analysis | 6 | Analyse architectural approaches for the high-priority scenarios |
| Testing | 7 | Brainstorm and prioritise scenarios with the whole stakeholder group (voting) |
| Testing | 8 | Analyse architectural approaches again against the highly ranked scenarios |
| Reporting | 9 | Present results |
The method's outputs have a precise vocabulary:
| Output | Meaning (SEI report) | Example |
|---|---|---|
| Risk | An architecturally important decision that has not been made, or one that is problematic | "Undecided whether the cache is shared across tenants" |
| Non-risk | A decision judged sound for the scenario | "Retries use exponential backoff with jitter" |
| Sensitivity point | "a property of one or more components ... that is critical for achieving a particular quality attribute response" | Number of encryption bits for confidentiality |
| Trade-off point | A property that is a sensitivity point for more than one attribute | Encryption level: security up, latency down |
Step Activity Output
1 1 Business drivers: "fast checkout, never lose an order" Two top qualities
2 2 Utility tree: 8 leaf scenarios, rate (importance, difficulty) 2 leaves are (H,H)
3 3 Walk the (H,H) leaf: "DB loss, RPO 0, RTO 15 min" Risk: no cross-region replica yet
4 4 Walk (H,M) leaf: "p95 300 ms at 200 rps" Sensitivity point: connection pool size
5 5 Record trade-off: sync replication vs write latency Trade-off point -> ADRReal scenarios: a start-up picks Postgres plus a queue for a seed-stage product after ranking scenarios; a platform team evaluates whether to split a monolith by checking that the split improves the (H,H) scenarios and does not worsen availability.
Fix: keep the tree on one page, rate with H, M, L on importance and difficulty, and review it each quarter. Scenarios rated (L,L) are not worth a design discussion.
Fitness functions Important
In plain words: a fitness function is an automated test for an architectural quality. It fails the build when the system drifts away from what the design needs.
Common misunderstanding: "Fitness functions are a framework you must install." They are an idea. Any test, benchmark, linter rule, alert or chaos experiment that returns pass or fail on a quality attribute is a fitness function.
Definition: Ford, Parsons and Kua define an evolutionary architecture as one that "supports guided, incremental change as the first principle across multiple dimensions" (Thoughtworks' quotation), and the fitness function is the guide. Thoughtworks adds that they "describe how close an architecture is to achieving an architectural aim" and that they apply to monoliths and microservices alike. The book also classifies them (we summarise it from secondary descriptions; check the book before relying on the exact terms):
| Axis | Choices | Example |
|---|---|---|
| Scope | Atomic (one attribute) vs holistic (several together) | Import check vs load test with security headers |
| Trigger | Triggered (CI, release) vs continual (always running in production) | Unit test vs production SLO alert |
| Result | Static (fixed pass or fail) vs dynamic (depends on context) | Maximum cyclomatic complexity vs latency budget that scales with load |
| Timing | Automated vs manual | Pipeline vs quarterly security review |
Commit Fitness function Result
1 c101 domain imports no infrastructure package pass
2 c102 p95 /quote under 50 ms (benchmark in CI) pass
3 c103 dev adds database/sql import in domain/order.go FAIL: "domain must not depend on infrastructure"
4 c104 developer moves the query to the repository pass
5 c105 new dependency raises binary to 120 MB (limit 100) FAIL: size budgetReal scenarios: "no cycles between modules" (modularity); "no endpoint without an authorisation test" (security); "p95 of checkout under 300 ms in the nightly load test" (performance); "cold start under 500 ms" (flexibility); "any service that exposes metrics follows the naming guide" (operability); "dependency licences are allowed" (compliance).
| Quality | Fitness function | Go | Laravel |
|---|---|---|---|
| Modularity | Layers only point inward | go-arch-lint, go/parser import test | Deptrac, Pest arch() |
| Time behaviour | Latency budget | testing plus percentile helper | Pest test with Benchmark::value |
| Maintainability | Cyclomatic complexity cap | gocyclo, golangci-lint | PHPStan, PHP_CodeSniffer complexity rules |
| Security | Known vulnerabilities fail CI | govulncheck | composer audit |
| Testability | Coverage floor on domain | go test -cover | PHPUnit coverage |
| Resilience | Kill a pod in staging, SLO holds | Chaos Mesh job | Same, any language |
What provides it: go test, govulncheck, golangci-lint, go-arch-lint, Pest, PHPStan, Larastan, Deptrac, k6, GitHub Actions, GitLab CI. See code below.
Fix: convert each top scenario's response measure into a test or an alert, put the test in CI, and treat a red fitness function like a red unit test.
Requirements smells: vague, unverifiable, solution-in-requirement Important
In plain words: some words in a requirement are warning signs that nobody can test it ("fast", "user-friendly", "as far as possible", "use Redis").
Common misunderstanding: "A vague requirement is fine because we will clarify it later." Femmer et al. (arXiv 1611.08847) note that bad requirements quality "can cause expensive consequences during the software development lifecycle, especially if iterations are long and feedback comes late." Clarifying in development costs more than clarifying in the sentence.
Definition: a requirements smell is a word or phrase that hints at a quality defect, in the same spirit as code smells; the paper derives them from the ISO 29148 language criteria. The first five rows follow the paper's smell list; the last four are common additions that are not from the paper:
| Smell | Definition (paper) | Bad | Better |
|---|---|---|---|
| Subjective language | Words whose semantics are "not objectively defined, such as user friendly, easy to use, cost effective" | "The checkout must be user-friendly" | "A new shopper completes checkout in under 90 s without help (usability test, 5 of 5 users)" |
| Ambiguous adverbs and adjectives | Unspecific by nature, such as "almost always, significant and minimal" | "Pages must load quickly" | "Product page p95 under 800 ms on 4G" |
| Loophole | Phrases that make a requirement hold "only to a certain, imprecisely defined extent": "As far as possible" | "Inputs are validated as far as possible" | "All fields are validated against the schema; unknown fields are rejected" |
| Open-ended, non-verifiable terms | Phrases like "etc.", "and so on", "including but not limited to" | "Supports CSV, XLSX, etc." | "Supports CSV and XLSX; other formats are out of scope for v1" |
| Superlative and comparative | "best", "faster" with no baseline | "Faster than the old system" | "p95 at most 70% of the current 420 ms" |
| Solution in requirement | Names a technology instead of the need | "Use Redis for sessions" | "Session reads under 5 ms p99; sessions survive a node restart" (the choice of Redis is a design decision) |
| Missing measure | A quality with no number | "Highly available" | "99.9% monthly availability, measured as non-5xx at the load balancer" |
| Untestable negative | "Never fails" | "The system never loses data" | "RPO 5 min; restore drill passes quarterly" |
| Compound requirement | Several "and" statements in one | "Secure, fast and scalable" | Three separate scenarios |
| Passive voice with no actor | Who does it? | "The data is encrypted" | "The service encrypts data at rest with AES-256-GCM using keys managed in KMS" |
Review Sentence Smell found Rewrite
1 r1 "The API must be fast and easy to integrate." ambiguous adjective + subjective "p95 under 200 ms; OpenAPI 3.1 spec and a sandbox"
2 r2 "Store sessions in Redis." solution in requirement "Sessions survive a rolling deploy; read p99 under 5 ms"
3 r3 "Validate input where appropriate." loophole "Reject any request that does not match the schema"
4 r4 "Support payments, refunds, etc." open-ended "v1: payments and full refunds"What provides it: peer review with a smell list; the Go function in snippets as a pre-commit check; research prototypes such as Smella from the cited paper. Tools only point; a human rewrites.
Fix: for every smell ask three questions: who is the actor, what number would prove it, and is this a need or already a solution?
User stories, use cases and job stories Important
In plain words: three ways to write what users want. A user story is a one-line promise to discuss; a use case is a step-by-step interaction with alternatives; a job story describes a situation and a motivation instead of a persona.
Common misunderstanding: "A user story is the requirement." Cohn: "That sentence is a reminder to have a conversation; the full requirement emerges through the conversation that follows." The story is a token for the requirement; the acceptance criteria and the scenarios are the requirement.
Definition:
| Aspect | User story | Use case | Job story |
|---|---|---|---|
| Template | "As a [type of user], I [need/want/am required] to [do something], so that [reason or benefit]." (Mike Cohn) | Goal, actors, preconditions, main success scenario, extensions, postconditions (Cockburn; we describe it from general knowledge, the source page was not available) | "When [situation], I want to [motivation], so I can [expected outcome]." (Alan Klement; summarised by Cohn and Intercom) |
| Focus | Who and why | The interaction between actor and system | The situation and the job |
| Size | Small, fits a sprint | Larger, documents flows and alternatives | Small, like a story |
| Strength | Planning, conversation | Completeness, error flows | Avoids invented personas |
| Weakness | Shallow alone; stories hide NFRs | Heavy; can be shelf-ware | Less known to stakeholders |
| NFR home | Acceptance criteria | Special requirements section | Outcome clause |
| Best with | Agile backlog | Regulated or integration-heavy work | Product discovery |
Cohn on job stories: the situation "follows the word when in the template and provides context on when the story is being performed or perhaps what triggered the story" with examples such as "When an order is submitted…". Intercom's argument is that user stories have "three big problems": they use personas, couple implementation with motivations and outcomes, and "ignore context, situations, and anxieties".
Format Same requirement
1 User story As a shopper, I want to pay by card so that my order is confirmed.
2 Job story When I am on a slow mobile connection at the checkout, I want my payment to be confirmed without a second click, so I can leave without worrying it was charged twice.
3 Use case UC-3 Pay for cart. Actor: shopper. Main: 1 select card; 2 submit; 3 system charges; 4 system shows confirmation. Ext 3a: card declined, return to step 1.Real scenarios: an internal agile team uses stories; a bank integrating with a payment network uses use cases with exception flows; a discovery team uses job stories to find opportunities.
What provides it: Jira, Linear, Azure DevOps hold stories; Cockburn's template or PlantUML use-case diagrams hold use cases; INVEST (independent, negotiable, valuable, estimable, small, testable; Bill Wake, 2003, from general knowledge) is a story-quality checklist.
Fix: write NFRs as acceptance criteria on stories only when they are specific to that story; write system-wide NFRs once as scenarios and link them from the stories.
Acceptance criteria and Gherkin Important
In plain words: acceptance criteria are the checks that say "this story is done". Gherkin is a plain-text format (Given, When, Then) that people can read and a test runner can execute.
Common misunderstanding: "Gherkin is for testers." The Cucumber reference says Gherkin uses keywords "to give structure and meaning to executable specifications"; its purpose is shared understanding between product, developers and testers, and only secondarily test automation.
Definition: a feature file has Feature, optional Background, one or more Scenario or Scenario Outline with Examples, and Rule blocks (added in later Gherkin versions) to group scenarios by business rule. The Cucumber reference says the free text under Feature is a place for "a brief explanation and a list of business rules (general acceptance criteria)".
| Keyword | Role |
|---|---|
| Feature | Names the capability |
| Rule | Groups scenarios for one business rule |
| Background | Steps repeated before every scenario |
| Scenario | One concrete example |
| Scenario Outline + Examples | One scenario with a data table |
| Given | Context, the state before |
| When | The action or event |
| Then | The observable outcome |
| And, But | Continue the previous keyword |
Feature: Place an order
As a shopper
I want to pay for my cart
So that the goods are reserved and shipped
Background:
Given a shopper with a cart of 2 items totalling 120.00 EUR
Rule: Stock is reserved exactly once
Scenario: Successful payment reserves stock
Given every item is in stock
When the shopper pays with a valid card
Then an order is created with status "paid"
And stock is reduced by 2 units
Scenario: A retried request does not double-charge
Given the shopper already paid with idempotency key "k-123"
When the same request with key "k-123" is sent again
Then the response is the original order
And the card is charged exactly once
Rule: Quality attribute scenarios are also scenarios
Scenario Outline: Latency budget at normal load
Given 200 concurrent shoppers at normal load
When they submit POST /orders
Then the <percentile> latency is below <limit> ms
Examples:
| percentile | limit |
| 95th | 300 |
| 99th | 800 |Quality scenarios fit the same format (see the last Scenario Outline): the response measure becomes the Then and the load becomes the Given. Implementations: Cucumber (Ruby, JVM, JS), godog for Go, Behat for PHP, Pest and PHPUnit for Laravel without Gherkin when the team does not need non-programmers to read the files.
What provides it: godog (the official Cucumber implementation for Go), Behat with the Laravel extension, Cucumber.js with Playwright.
Fix: write the Gherkin before the code, keep scenarios at the level of business language (no CSS selectors), and put quality numbers in Examples tables so they can change without rewriting steps.
Constraints vs requirements Important
In plain words: a requirement is something you must achieve and may design freely to meet; a constraint is a fixed boundary on how you may design. Requirements are negotiable in priority; constraints are not, unless someone with authority changes them.
Common misunderstanding: "Constraints are bad requirements and should be removed." Constraints are legitimate and common; the smell is a requirement written as a constraint ("use microservices") without a reason.
Definition:
| Aspect | Requirement | Constraint |
|---|---|---|
| Who decides | Stakeholders, negotiable | Outside the team: law, contract, budget, existing platform |
| Tells you | What outcome and how well | What you must not or must use |
| Design freedom | Many ways to satisfy | Reduces the options |
| Changes via | Backlog and trade-offs | Escalation or renegotiation |
| Example | "Recover from regional outage in 30 min" | "Data of EU customers stays in the EU" |
| Test | Scenario | Compliance check, architecture test |
| Type | Examples |
|---|---|
| Business | Fixed launch date, budget cap, team of four |
| Technical | Must run on PostgreSQL 16, Go 1.24 only, PHP 8.4 and Laravel 13 |
| Organisational | Single on-call rota, no new language without approval |
| Legal and regulatory | GDPR residency, PCI DSS card-data scope, retention of invoices for 7 years |
| Interface | Must call the bank's SOAP API |
Real scenarios: a payment system must stay out of PCI scope, so card numbers never touch it (a constraint that becomes a design rule); a start-up is told "no on-call", which caps availability goals.
Fix: keep constraints in their own list with an owner and a reason, so you can say "this is a constraint because of the contract with X, expires in 2027".
Architecturally significant requirements Good to know
In plain words: among all requirements, a few change the architecture if you get them wrong. Those are architecturally significant requirements (ASRs). Find them first.
Common misunderstanding: "All NFRs are ASRs." Most are cheap to meet in any structure. An ASR is one with a high cost of change that has real business value and risk (the (H,H) leaves of the utility tree).
Definition: a requirement is architecturally significant when it is expensive to change later and it forces a structural decision: data placement, process boundaries, consistency model, trust boundary.
| Candidate | ASR? | Why |
|---|---|---|
| "Page loads in under 2 s" at 100 users | Rarely | Straightforward in any stack |
| "Works offline for 24 hours and syncs later" | Yes | Needs a local store and conflict resolution |
| "Each tenant's data is isolated cryptographically" | Yes | Changes keys, schema and operations |
| "Change tax rules without a deploy" | Yes | Rules become data, with an engine |
| "Colour of the button" | No | Local change |
Fix: list at most five ASRs, rank them, and review any design against them first.
"Non-functional" is a poor name Good to know
In plain words: the word suggests "not about functions", but many qualities are exactly about functions (a function that is too slow is broken). Other names: quality attributes, quality requirements, cross-functional requirements, system qualities, architectural characteristics, the "-ilities".
Common misunderstanding: "Pick the right name and the argument is over." The names matter less than writing measurable scenarios.
Definition: this chapter uses quality attribute for the property (availability), quality attribute requirement or NFR for a stated target, and scenario for the testable form.
| Name | Used by |
|---|---|
| Non-functional requirement (NFR) | Requirements engineering, product teams |
| Quality attribute | SEI, architecture literature |
| Architectural characteristic | Wikipedia and many architecture books for the same idea |
| Cross-functional requirement | Some agile teams |
| "-ility" | Casual: scalability, availability, maintainability |
Fix: pick one name per organisation, put it in the glossary, move on.
Mechanics: from a sentence to a test
The pipeline Must-know
In plain words: talk to people, write scenarios, choose the few that matter, pick design moves (tactics) that satisfy them, then write the checks that keep them true.
Stage Input Output Artifact
1 Elicit Stakeholder interviews Raw wishes and constraints Notes
2 Classify Wishes FR / NFR / constraint Requirements list
3 Scenario NFRs Six-part scenarios Scenario catalogue
4 Prioritise Scenarios Ranked (importance, difficulty) Utility tree
5 Decide Top scenarios Tactics and trade-offs ADRs
6 Verify Response measures Tests, alerts, fitness functions CI and monitoring
7 Operate SLIs SLO, error budget Dashboard, policyTactics: design moves that buy a quality Important
In plain words: a tactic is a known design move that pushes one quality in a chosen direction. Bass et al. catalogue them per attribute; the names below are the standard ones, from the architecture literature (we did not read the catalogue chapters in this session, so verify names in the book before quoting).
Common misunderstanding: "A tactic is a pattern." A pattern is a bundle of many tactics with trade-offs; a tactic is one small move.
| Attribute | Tactic | What it does | Cost |
|---|---|---|---|
| Availability | Heartbeat, redundancy, failover | Detect and replace failed nodes | Money, complexity |
| Availability | Retry with backoff and jitter, circuit breaker | Survive transient faults | Duplicate work, risk of retry storms |
| Performance | Cache, queue, parallelism, bounded queue | Reduce latency or protect capacity | Staleness, complexity |
| Performance | Reduce chattiness, batch | Fewer round trips | Coupling |
| Modifiability | Information hiding, interfaces, dependency inversion | Localise change | Indirection |
| Security | Authenticate, authorise, encrypt, audit, limit exposure | Confidentiality and integrity | Friction, CPU |
| Testability | Dependency injection, record and replay | Isolate the unit | More types |
| Scalability | Stateless services, sharding, async processing | Add capacity by adding nodes | Consistency issues |
| Recoverability | Backups, PITR, replicas, runbooks | Meet RPO and RTO | Storage, drills |
Many of these have their own chapters: Error Handling & Fault Tolerance, Concurrency Design, Security by Design, the Dependency Inversion Principle, and in the database section Backup, PITR & Disaster Recovery.
Measuring honestly Important
In plain words: a latency number is only as good as how you measured it.
Common misunderstanding: "A load test on my laptop proves the SLO." It proves the code on your laptop at that load; it ignores network, noisy neighbours and production data volume.
| Pitfall | Effect | Defence |
|---|---|---|
| Averaging percentiles across hosts | Meaningless number | Aggregate histogram buckets |
| Coordinated omission (the load generator waits for slow replies and so sends fewer requests during stalls; named by Gil Tene, from general knowledge) | Understates tail latency | Open-model load (fixed arrival rate): k6 constant-arrival-rate, vegeta, wrk2 |
| Warm caches only | Hides cold-start cost | Measure cold and warm separately |
| Tiny data set | Plans differ at scale | Production-sized data |
| Client vs server timing | Different numbers | State where measured; the SRE book notes client-side latency is often more user-relevant |
| Single run | Noise | Repeat, report variance |
| Shared CI runners | Flaky tests | Use generous but finite budgets, retry once, trend over time |
Go
A single module holds all Go snippets; run cd docs/snippets/design/quality-attributes-requirements/go && go vet ./... && go test ./....
Latency budget as a test
The scenario "p95 of GET /quote under 50 ms, p99 under 120 ms" becomes a Go test. The numbers are copied from the requirement; they are never "today's measurement plus 10%".
// Package handler is the system under test for the latency budget.
package handler
import (
"net/http"
"time"
)
// Quote answers GET /quote. The sleep stands in for a database read.
func Quote(w http.ResponseWriter, _ *http.Request) {
time.Sleep(2 * time.Millisecond)
w.Header().Set("Content-Type", "application/json")
_, _ = w.Write([]byte(`{"price":1200}`))
}package handler
import (
"net/http"
"net/http/httptest"
"slices"
"testing"
"time"
)
// percentile uses the nearest-rank method on a sorted copy.
func percentile(samples []time.Duration, p float64) time.Duration {
s := slices.Clone(samples)
slices.Sort(s)
rank := int(p/100*float64(len(s))+0.5) - 1
rank = max(0, min(rank, len(s)-1))
return s[rank]
}
// QAS: GET /quote, normal load, 95th percentile under 50 ms, 99th under 120 ms.
// The budget is taken from the requirement, never from today's measurements.
func TestQuoteLatencyBudget(t *testing.T) {
const (
runs = 500
p95Max = 50 * time.Millisecond
p99Max = 120 * time.Millisecond
)
srv := httptest.NewServer(http.HandlerFunc(Quote))
defer srv.Close()
samples := make([]time.Duration, 0, runs)
for range runs {
start := time.Now()
resp, err := http.Get(srv.URL)
if err != nil {
t.Fatal(err)
}
_ = resp.Body.Close()
samples = append(samples, time.Since(start))
}
if got := percentile(samples, 95); got > p95Max {
t.Errorf("p95 = %v, budget %v", got, p95Max)
}
if got := percentile(samples, 99); got > p99Max {
t.Errorf("p99 = %v, budget %v", got, p99Max)
}
}Fitness function in CI: the domain stays pure
An ArchUnit-style rule using only the standard library: parse the import blocks of domain/*.go and fail if they name net/http, database/sql or any third-party module.
// Package domain holds business rules. The fitness test forbids it from
// importing transport or storage packages.
package domain
import "errors"
// Order is a minimal aggregate used by the fitness function.
type Order struct {
ID string
Total int64
}
// Validate keeps the rule free of I/O.
func (o Order) Validate() error {
if o.Total <= 0 {
return errors.New("total must be positive")
}
return nil
}// Package adapter may import anything; it is the outer layer.
package adapter
import (
"net/http"
"academy/quality-attributes-requirements/fitness/domain"
)
// Handle validates an order and answers with a status code.
func Handle(w http.ResponseWriter, _ *http.Request) {
if err := (domain.Order{ID: "o-1", Total: 100}).Validate(); err != nil {
http.Error(w, err.Error(), http.StatusUnprocessableEntity)
}
}package fitness
import (
"go/parser"
"go/token"
"path/filepath"
"strconv"
"strings"
"testing"
)
// Fitness function: "the domain package must stay free of I/O".
// It parses only the import blocks, so it runs in milliseconds in CI.
var forbidden = []string{"net/http", "database/sql", "os/exec", "github.com/"}
func TestDomainImportsNoInfrastructure(t *testing.T) {
files, err := filepath.Glob("domain/*.go")
if err != nil || len(files) == 0 {
t.Fatalf("no domain files found: %v", err)
}
fset := token.NewFileSet()
for _, f := range files {
parsed, err := parser.ParseFile(fset, f, nil, parser.ImportsOnly)
if err != nil {
t.Fatal(err)
}
for _, imp := range parsed.Imports {
path, _ := strconv.Unquote(imp.Path.Value)
for _, bad := range forbidden {
if strings.HasPrefix(path, bad) {
t.Errorf("%s imports %q: the domain layer must not depend on infrastructure", f, path)
}
}
}
}
}The same rule as configuration, for go-arch-lint (README: "Linter used to enforce some good project structure and validate top level architecture (code layers)"):
version: 3
workdir: fitness
components:
domain: { in: domain }
adapter: { in: adapter }
commonComponents:
- domain
deps:
adapter:
mayDependOn:
- domain
# domain has no mayDependOn entry, so it may depend on nothing but the stdlibRun it in CI with go-arch-lint check (verify the exact command against the version you install: the README documents a check command, and the config syntax shown follows the README example for version: 3).
Error budget arithmetic
// Package budget turns an availability target into minutes you can spend.
package budget
import "time"
// AllowedDowntime returns how long a service may be unavailable inside the
// window and still meet the availability target (0.999 means "three nines").
func AllowedDowntime(target float64, window time.Duration) time.Duration {
return time.Duration((1 - target) * float64(window))
}
// BudgetRemaining returns the fraction of the error budget still unspent,
// given the measured good and total request counts for the window.
// A negative value means the SLO is already broken.
func BudgetRemaining(target float64, good, total int64) float64 {
if total == 0 {
return 1
}
allowedBad := (1 - target) * float64(total)
actualBad := float64(total - good)
if allowedBad == 0 {
if actualBad == 0 {
return 1
}
return -1
}
return 1 - actualBad/allowedBad
}package budget
import (
"math"
"testing"
"time"
)
func TestAllowedDowntime(t *testing.T) {
month := 30 * 24 * time.Hour
cases := []struct {
target float64
want time.Duration
}{
{0.99, 7*time.Hour + 12*time.Minute},
{0.999, 43*time.Minute + 12*time.Second},
{0.9999, 4*time.Minute + 19*time.Second + 200*time.Millisecond},
}
for _, c := range cases {
got := AllowedDowntime(c.target, month)
if d := got - c.want; d > time.Second || d < -time.Second {
t.Errorf("target %v: got %v, want about %v", c.target, got, c.want)
}
}
}
func TestBudgetRemaining(t *testing.T) {
// 99.9% of 1,000,000 requests allows 1,000 bad ones; 250 bad leaves 75%.
got := BudgetRemaining(0.999, 999_750, 1_000_000)
if math.Abs(got-0.75) > 1e-9 {
t.Errorf("got %v, want 0.75", got)
}
}A requirements smell linter
A 40-line pre-commit check that flags subjective language, vague adverbs, loopholes, comparatives and technology names. It is deliberately crude: it finds candidates for a human to rewrite.
// Package smells flags requirement wording that cannot be verified.
package smells
import (
"regexp"
"strings"
)
// Finding names one smell found in one requirement sentence.
type Finding struct {
Smell string
Match string
}
var rules = []struct {
name string
re *regexp.Regexp
}{
{"subjective language", regexp.MustCompile(`(?i)\b(user[- ]friendly|easy to use|intuitive|simple|robust|modern|flexible)\b`)},
{"ambiguous adverb or adjective", regexp.MustCompile(`(?i)\b(fast|quickly|significant|minimal|almost always|reasonable|adequate|real[- ]time)\b`)},
{"loophole", regexp.MustCompile(`(?i)\b(as far as possible|if possible|where appropriate|when necessary|etc\.?)\b`)},
{"superlative or comparative", regexp.MustCompile(`(?i)\b(best|fastest|better|faster|more efficient|maximal)\b`)},
{"solution in requirement", regexp.MustCompile(`(?i)\b(use|using|via|with) (redis|kafka|postgres(ql)?|mysql|kubernetes|microservices?|rabbitmq)\b`)},
}
// Check returns every smell found in the sentence.
func Check(requirement string) []Finding {
var out []Finding
for _, r := range rules {
for _, m := range r.re.FindAllString(requirement, -1) {
out = append(out, Finding{Smell: r.name, Match: strings.ToLower(m)})
}
}
return out
}package smells
import "testing"
func TestCheck(t *testing.T) {
bad := "The checkout must be fast and user-friendly, using Redis, as far as possible."
got := Check(bad)
want := map[string]bool{
"ambiguous adverb or adjective": false,
"subjective language": false,
"solution in requirement": false,
"loophole": false,
}
for _, f := range got {
want[f.Smell] = true
}
for smell, seen := range want {
if !seen {
t.Errorf("expected smell %q in %q", smell, bad)
}
}
good := "95% of POST /orders requests complete in under 300 ms at 200 requests per second."
if f := Check(good); len(f) != 0 {
t.Errorf("unexpected findings for a measurable requirement: %v", f)
}
}The Go angle
| Need | Go tool |
|---|---|
| Benchmarks | testing.B, go test -bench, benchstat to compare runs |
| Load | vegeta, k6, hey |
| Profiling | pprof, go tool trace, runtime/metrics |
| Metrics | prometheus/client_golang histograms, OpenTelemetry Go SDK |
| Structure | go/parser, go-arch-lint, go list -deps, internal/ packages (compiler-enforced visibility) |
| Race and leak checks | go test -race, goleak |
| Vulnerabilities | govulncheck |
| Contract tests | net/http/httptest, testing/synctest (experimental flag in older Go releases) for deterministic time |
internal/ is the cheapest fitness function Go offers: the compiler refuses imports from outside the parent tree, so modularity is enforced before any linter runs.
Laravel
Laravel 13 on PHP 8.4. PHP snippets were reviewed, not executed.
Latency budget as a Pest test
Illuminate\Support\Benchmark::value() returns the callback result and the duration in milliseconds (Laravel 13 helpers documentation). The budgets come from the scenario.
<?php
declare(strict_types=1);
namespace Tests\Feature;
use Illuminate\Support\Benchmark;
/**
* QAS: GET /api/quote, normal load, 95th percentile under 50 ms,
* 99th percentile under 120 ms. Budgets come from the requirement.
*/
function percentile(array $samples, float $p): float
{
sort($samples);
$rank = (int) round($p / 100 * count($samples)) - 1;
return $samples[max(0, min($rank, count($samples) - 1))];
}
it('keeps GET /api/quote inside its latency budget', function () {
$samples = [];
// Warm up so route cache, opcache and the container do not skew run 1.
$this->getJson('/api/quote')->assertOk();
for ($i = 0; $i < 300; $i++) {
// Benchmark::value() returns [result, milliseconds].
[, $ms] = Benchmark::value(fn () => $this->getJson('/api/quote')->assertOk());
$samples[] = $ms;
}
expect(percentile($samples, 95))->toBeLessThan(50.0);
expect(percentile($samples, 99))->toBeLessThan(120.0);
})->group('budget'); // run with: php artisan test --group=budgetArchitecture tests with Pest and Deptrac
Pest's arch() expectations (toUse, toOnlyUse, toBeReadonly, toBeUsed) check namespaces and usage. Deptrac, "a static code analysis tool for PHP that helps you communicate, visualize and enforce architectural decisions in your projects", reads deptrac.yaml and runs in CI as vendor/bin/deptrac analyse.
<?php
declare(strict_types=1);
// tests/Arch/ArchTest.php - Pest architecture tests (the ArchUnit idea for PHP).
arch('domain is free of the framework')
->expect('App\Domain')
->not->toUse(['Illuminate\Http', 'Illuminate\Support\Facades']);
arch('models only depend on the database layer')
->expect('App\Models')
->toOnlyUse(['Illuminate\Database', 'Illuminate\Support', 'App\Models']);
arch('controllers never reach into infrastructure directly')
->expect('App\Http\Controllers')
->not->toUse('App\Infrastructure');
arch('no debug leftovers')
->expect(['dd', 'dump', 'ray'])
->not->toBeUsed();
arch('value objects are immutable')
->expect('App\Domain\ValueObjects')
->toBeReadonly();# deptrac.yaml - run in CI with: vendor/bin/deptrac analyse
deptrac:
paths:
- ./app
layers:
- name: Controller
collectors:
- type: classLike
value: App\\Http\\Controllers\\.*
- name: Application
collectors:
- type: classLike
value: App\\Application\\.*
- name: Domain
collectors:
- type: classLike
value: App\\Domain\\.*
- name: Infrastructure
collectors:
- type: classLike
value: App\\Infrastructure\\.*
ruleset:
Controller:
- Application
Application:
- Domain
Infrastructure:
- Domain
- Application
Domain: ~Error budget in PHP
<?php
declare(strict_types=1);
namespace App\Reliability;
use DateInterval;
/**
* Turns an availability SLO into minutes and tells you how much is left.
*/
final readonly class ErrorBudget
{
public function __construct(private float $target) // 0.999 = "three nines"
{
}
/** Seconds of full outage allowed inside the window. */
public function allowedDowntimeSeconds(DateInterval|int $window): float
{
$seconds = $window instanceof DateInterval
? (new \DateTimeImmutable('@0'))->add($window)->getTimestamp()
: $window;
return (1 - $this->target) * $seconds;
}
/** 1.0 = untouched, 0.0 = spent, negative = SLO broken. */
public function remaining(int $goodRequests, int $totalRequests): float
{
if ($totalRequests === 0) {
return 1.0;
}
$allowedBad = (1 - $this->target) * $totalRequests;
$actualBad = $totalRequests - $goodRequests;
if ($allowedBad == 0.0) {
return $actualBad === 0 ? 1.0 : -1.0;
}
return 1 - $actualBad / $allowedBad;
}
}The Laravel angle
| Need | Laravel or PHP tool |
|---|---|
| Latency in tests | Benchmark::value, Pest --group, Http::fake for stable dependencies |
| Throttling as a resistance NFR | RateLimiter::for() and the throttle middleware (rate-limiting docs) |
| Queue wait time | Laravel Horizon, Queue::size, php artisan queue:monitor |
| Production metrics | Laravel Pulse, OpenTelemetry PHP, Prometheus exporters |
| Structure | Pest arch(), Deptrac, Larastan levels |
| Security | composer audit, Policies and Gates tests |
| Octane | Persistent workers lift throughput; test for memory leaks across requests |
| Acceptance | Behat, Pest feature tests ($this->postJson()) |
Solving the classic problems
| Problem | Symptom | Solution | Cost |
|---|---|---|---|
| "Make it fast" | Endless tuning | Scenario with percentile and load, then a CI budget | An hour of negotiation per attribute |
| NFRs found in production | Outage on launch day | Utility tree and a premortem before design | Workshop time |
| Conflicting NFRs | Team argues | Trade-off ADR with an owner | A decision record |
| Gold plating | Five nines for an internal tool | Derive SLO from business loss per hour | Saying no |
| Drift | Quality slowly erodes | Fitness functions in CI | Test maintenance |
| Unowned qualities | "Everyone's job" | One owner per scenario | Name on a page |
| Unmeasured SLO | Dashboards with no thresholds | SLI definitions in code, burn-rate alerts | Observability work |
| Shared-fate redundancy | Two replicas die together | Separate zones, deploys, credentials | Cost |
"The system must be fast and reliable"
Step Question Answer (example)
1 1 Fast for whom, doing what? Shoppers submitting an order
2 2 How fast, at what percentile? 95% under 300 ms
3 3 At what load, where measured? 200 req/s, at the load balancer
4 4 Reliable meaning what? 99.9% non-5xx per 30 days
5 5 What happens when we miss it? Freeze risky releases (error budget policy)"Everything is a priority"
Force-rank with two letters (importance, difficulty) and refuse more than three (H,H) leaves. If everything is highest priority, nothing is.
"We cannot test an NFR"
Every response measure has a test form: latency (benchmark), availability (SLI plus chaos), modifiability (a time-boxed change experiment or a dependency rule), security (a test that attacks), usability (a task-based test with five users).
Choosing
| Situation | Focus qualities | Technique | Reason |
|---|---|---|---|
| New product, little known | Modifiability, time to market | Modular monolith, light scenarios | Cheap to change |
| Payments or ledger | Integrity, auditability, availability | Strict scenarios, ATAM-style review, immutable log | Mistakes cost money |
| Public API | Compatibility, security, performance | Versioning policy, SLOs, rate limits | Many consumers |
| Real-time or gaming | Time behaviour, capacity | p99 budgets, load tests | Tails ruin the experience |
| Regulated (health, finance) | Safety, security, compliance | Constraints list, evidence for each | Audit |
| Internal tool | Maintainability, installability | Few scenarios | Low risk |
| Mobile | Interaction capability, flexibility | Usability tests, device matrix | Users judge by feel |
| Data platform | Recoverability, capacity | RPO and RTO drills | Data loss is the main risk |
In architecture: from a single process to a distributed system
The same sentence, "the checkout is available 99.9%", means a different engineering task at each scale. Quality attributes do not shrink when you distribute; they split into per-component numbers that multiply.
Monolith: one process, one database
All qualities are decided by code structure and a few infrastructure choices. Availability is mostly the database plus the deploy process. Modifiability is module boundaries inside one repository. The fitness functions are import rules and benchmarks.
Request path (monolith) Quality exposure
1 HTTP -> middleware -> controller time behaviour (framework overhead)
2 controller -> service -> repository modularity (import rules)
3 repository -> PostgreSQL (same host or VPC) availability (one DB), recoverability (backups)
4 response p95 measured hereExample: a Laravel shop with a single PostgreSQL. NFRs: p95 300 ms, 99.9% monthly, RPO 5 min. Design moves: connection pooling, an index, PITR with WAL archiving, Pest arch tests that keep App\Domain free of Illuminate\Http.
Modular monolith and multiple databases
Boundaries become the main modifiability tool. Each module has its own scenarios (the billing module: change tax rule in one day with no edit outside billing/) and its own budgets. A read replica adds a consistency trade-off: reports may lag.
| Mechanism | Quality gained | Quality given up |
|---|---|---|
Module facades and internal/ packages | Modularity, modifiability | A little indirection |
| One schema per module | Modularity | Cross-module joins |
| Read replica for reports | Time behaviour on the primary | Stale reads (see Replication & Failover) |
| Deptrac or go-arch-lint per module | Enforced boundaries | CI minutes |
Microservices: SLOs per service
Each service has its own SLIs and SLOs, and the composite availability is the product along the call path. Three 99.9% services in series give 99.7%; to keep the user-facing 99.9%, each hop needs about 99.97%, or the path needs fewer synchronous hops, caching or asynchronous messaging.
Service Own SLO Called synchronously by checkout Composite effect
1 gateway 99.99% yes 0.9999
2 checkout 99.95% - 0.9994
3 payments 99.9% yes 0.9984
4 inventory 99.9% yes 0.9974
5 email 99.5% no (async via queue) unchanged
6 Result user-facing target 99.9% is MISSED unless payments/inventory improve or one call becomes async| Design move | Effect on the budget |
|---|---|
| Make email asynchronous | Removes it from the serial chain; its failure no longer spends checkout's budget |
| Timeouts shorter than the caller's SLO | Prevents tail latency from adding up |
| Per-dependency circuit breaker | Protects availability, adds a degraded mode that must be specified |
| Per-service error budgets | Teams ship independently; see Distribution of Components |
| Contract tests as fitness functions | Compatibility survives independent deploys |
Example flow: checkout calls payments (timeout 800 ms, 1 retry with jitter) and inventory (timeout 300 ms); a slow inventory p99 of 1.2 s breaks the checkout p99 unless the call has a deadline and a fallback ("reserve optimistically, confirm later").
Distributed data: replicas, caches and consistency choices
Quality attributes now include which consistency you offer. A consistency choice is a quality attribute scenario: "after a user changes their address, the next page shows the new one" is read-your-writes; "ranking updates within 5 minutes" is bounded staleness.
| Operation | Choice | Quality bought | Quality lost |
|---|---|---|---|
| Payment capture | Strong consistency, single primary | Integrity | Availability in a partition |
| Product catalogue | Cache for 60 s, replicas | Time behaviour, availability | Freshness |
| Like counter | Eventual, asynchronous aggregation | Throughput | Exactness |
| Inventory reservation | Single partition owner, compare-and-set | Integrity | Cross-region latency |
| Session | Sticky or replicated store | Resilience | Cost |
See Eventual Consistency in Databases for the mechanics, and Backup, PITR & Disaster Recovery for RPO and RTO. Cross-region active-active raises latency to hundreds of milliseconds for any strongly consistent write: that number must appear in the scenario, not be discovered.
Scaling path: 1x, 10x, 100x
| Load | Typical NFR focus | Design move | Fitness function |
|---|---|---|---|
| 1x (hundreds of requests per second) | Correctness, modifiability | Monolith, one database, backups | Unit tests, import rules |
| 10x | Latency, capacity | Caching, read replicas, connection pooling, queues | Load test in CI nightly, p95 budget |
| 100x | Availability, cost, consistency | Sharding, service split, multi-AZ, backpressure | SLO burn alerts, chaos drills, per-service budgets |
Do not design for 100x at 1x: an unmeasured requirement is a guess. The scenario carries a growth assumption ("10x orders within 18 months") and a revisit date.
Worked requirements document: "Place order"
A complete, compact requirements document for one feature of an online shop, using everything above.
1. Context and goal. Shoppers pay for a cart; the system confirms, reserves stock and sends a receipt. Business driver: conversion and trust ("never charge twice, never oversell").
2. Stakeholders. Shopper, support, finance, warehouse, payment provider, security officer.
3. Functional requirements.
| ID | Requirement | Acceptance (Gherkin file above) |
|---|---|---|
| FR-1 | A shopper can pay for a cart with a card | "Successful payment reserves stock" |
| FR-2 | A retried request with the same idempotency key returns the original order | "A retried request does not double-charge" |
| FR-3 | Stock is reserved exactly once per paid order | Same as FR-1 |
| FR-4 | A receipt email is sent after payment | Email sent within 1 minute (see NFR-5) |
| FR-5 | Support can see the order's history | Role check test |
4. Quality attribute scenarios.
| ID | Attribute (25010) | Scenario (source, stimulus, artifact, environment, response, measure) | Priority |
|---|---|---|---|
| NFR-1 | Time behaviour | 200 shoppers submit POST /orders to the checkout service at normal load; it stores the order and returns 201; p95 under 300 ms, p99 under 800 ms | (H,M) |
| NFR-2 | Capacity | Black Friday: 10x orders per hour; service scales out; no request waits in a queue over 10 s | (H,H) |
| NFR-3 | Availability, fault tolerance | One of three app nodes dies at peak; load balancer removes it; failed requests at most 0.1% for 30 s | (H,M) |
| NFR-4 | Recoverability | Operator drops the orders table; restore with PITR; RPO 5 min, RTO 30 min | (H,H) |
| NFR-5 | Time behaviour (asynchronous) | After payment, receipt email enqueued; 99% sent within 60 s | (M,L) |
| NFR-6 | Integrity | Attacker changes the price in the request; server recomputes; 100% rejected and audited | (H,L) |
| NFR-7 | Confidentiality | No PAN or CVV in logs or database (scan finds zero); card data handled only by the provider's hosted fields | (H,L) |
| NFR-8 | Modifiability | Developer adds a payment provider in under 3 person-days with no change outside payment/ | (M,M) |
| NFR-9 | Testability | Pricing rules unit tests run in under 20 s without a database | (M,L) |
| NFR-10 | Interaction capability (inclusivity) | A keyboard-only user completes checkout; WCAG 2.2 AA checks pass in CI | (M,M) |
5. SLOs for operation. Availability SLI: non-5xx share of POST /orders at the load balancer; SLO 99.9% over 30 days (error budget 43 min). Latency SLI: share of requests under 300 ms; SLO 95%.
6. Constraints. C-1: card data stays out of our systems (PCI DSS scope). C-2: PostgreSQL 16 on the existing cluster. C-3: EU customers' data stays in the EU. C-4: PHP 8.4 and Laravel 13; Go for the pricing service.
7. Out of scope. Subscriptions, multi-currency, gift cards.
8. Trade-offs recorded. ADR-1: outbox relay adds up to 200 ms to receipt delivery; accepted (NFR-5 allows 60 s). ADR-2: strong consistency for stock reservation in one region; cross-region orders pay extra latency.
9. Verification plan.
| Requirement | Check | Where |
|---|---|---|
| NFR-1 | Latency budget test (Go TestQuoteLatencyBudget, Pest --group=budget), k6 nightly | CI |
| NFR-2 | k6 ramp to 10x on staging | Weekly |
| NFR-3 | Chaos experiment: kill one pod | Monthly |
| NFR-4 | Restore drill into scratch environment | Quarterly |
| NFR-6 | Feature test that tampers with the price | CI |
| NFR-7 | Log scanner for PAN regex | CI |
| NFR-8, NFR-9 | Deptrac or go-arch-lint, test duration budget | CI |
| NFR-10 | axe-core in Playwright | CI |
| SLO | Burn-rate alerts | Production |
Smell check of the original request "the checkout must be fast, secure and reliable, using Redis": three compound adjectives (ambiguous), one solution (Redis), no measures. The nine numbers above replace it.
Lab: from a smell to a failing build
cd docs/snippets/design/quality-attributes-requirements/go
go vet ./... && go test ./...
# ok academy/quality-attributes-requirements/budget
# ok academy/quality-attributes-requirements/fitness
# ok academy/quality-attributes-requirements/latency/handler
# ok academy/quality-attributes-requirements/smells- Break the latency budget. In
latency/handler/handler.gochange the sleep to80 * time.Millisecondand rungo test ./latency/.... Expected:p95 = 8x.xms, budget 50ms. Put the sleep back. - Break the architecture. Add
import _ "net/http"tofitness/domain/order.goand rungo test ./fitness/.... Expected:domain/order.go imports "net/http": the domain layer must not depend on infrastructure. - Run the smell linter. In
smells/smells_test.goreplace the good sentence with "The system should be fast, robust, etc." and read which smells fire (ambiguous adjective, subjective language, loophole). - Spend an error budget. Call
BudgetRemaining(0.999, 999_000, 1_000_000): allowed bad requests are 1,000 and actual bad are 1,000, so the budget is exactly spent and the result is about 0. Change the good count to 998,500 and the result is -0.5 (the SLO is broken, with 50% more failures than allowed). - PHP side (if you have a Laravel app). Copy
ArchTest.phpintotests/Arch/, run./vendor/bin/pest --filter=arch, then adduse Illuminate\Http\Request;in a class underApp\Domainand watch it fail. - Write your own. Take one sentence from your current project, run it through the smell table, write a six-part scenario, and add one test.
Common misconceptions
| Belief | Reality |
|---|---|
| Non-functional means unimportant | A system missing its qualities is unusable regardless of features |
| Average latency is enough | Percentiles expose the tail; averages hide 5% of users |
| 100% availability is the goal | It is unachievable and blocks delivery; choose an SLO and spend the budget |
| Five nines means better | Each nine multiplies cost; derive the target from business loss |
| Qualities are independent | They trade off; every decision moves several |
| ISO 25010 tells you what to build | It names qualities; you choose and measure them |
| We can add quality at the end | Structure decides performance, availability and security |
| A user story is the requirement | It is a token for a conversation plus acceptance criteria |
| Microservices improve all qualities | They improve independent deployability and cost availability and latency |
| Fitness functions need a special tool | Any automated pass or fail check on a quality is one |
| A constraint is a bad requirement | Constraints are legitimate; unjustified ones are the smell |
| Redundancy always raises availability | Only if failures are independent |
Cheat sheet
| Topic | What to remember |
|---|---|
| FR vs NFR | What it does vs how well; attach the quality to the feature's acceptance criteria |
| Constraint | A fixed boundary decided elsewhere; record owner and reason |
| ISO 25010:2023 | Nine characteristics: functional suitability, performance efficiency, compatibility, interaction capability, reliability, security, maintainability, flexibility, safety |
| Scenario | Source, stimulus, artifact, environment, response, response measure |
| Latency | State percentile, window, load, place of measurement |
| Nines | 99.9% = 43 min per 30 days; 99.99% = 4 min 19 s |
| Serial availability | Multiply; three 99.9% services give 99.7% |
| RPO / RTO | Data you can lose / time to be back |
| SLI, SLO, SLA | Measurement, target, contract |
| Error budget | 100% minus SLO; spend it on releases, stop when gone |
| Trade-offs | Name the winner and the loser in an ADR |
| Utility tree | Quality, refinement, scenario, (importance, difficulty) |
| ATAM output | Risks, non-risks, sensitivity points, trade-off points |
| Fitness function | Automated pass or fail on an architectural quality, in CI |
| Smells | Vague words, loopholes, missing numbers, technology as requirement |
| Stories | User story = promise to talk; use case = flows; job story = situation + motivation |
| Gherkin | Given, When, Then, plus Rule, Background, Scenario Outline |
| Scale | Per-service SLOs multiply; consistency is a quality choice |
Self-check: questions & answers
- Must-know asked in almost every interview
- Important frequent; expected at senior level
- Good to know extra depth that sets you apart
1 — Classify: "Only the account owner can download invoices", "Download of a 50 MB invoice bundle takes under 10 s at p95", "Invoices stay on EU servers". Must-know
Answer
Answer: The first is a functional rule (access control behaviour) that also expresses confidentiality; the second is a quality attribute (time behaviour) with a percentile; the third is a constraint (legal residency) decided outside the team.
2 — List the nine ISO/IEC 25010:2023 characteristics and name two sub-characteristics of reliability. Good to know
Answer
Answer: Functional suitability, performance efficiency, compatibility, interaction capability, reliability, security, maintainability, flexibility, safety. Reliability has faultlessness, availability, fault tolerance and recoverability.
3 — Name the six parts of a quality attribute scenario. Important
Answer
Answer: Source of stimulus, stimulus, artifact, environment, response, response measure.
4 — Why is "average latency under 200 ms" a weak requirement? Must-know
Answer
Answer: The mean hides the tail: 5% of requests can be many times slower without moving the average. State percentiles (p95, p99), load and where it is measured.
5 — How much downtime does 99.9% allow in 30 days, and what do three serial services at 99.9% give together? Must-know
Answer
Answer: 43 minutes 12 seconds; 0.999 cubed is about 99.7%, roughly 2 hours 10 minutes per 30 days.
6 — What is the difference between RPO and RTO? Must-know
Answer
Answer: RPO is how much recent data you may lose (time between the last recoverable point and the failure); RTO is how long you may take to be back in service.
7 — What does an error budget let a team do? Important
Answer
Answer: It turns the SLO into an allowed amount of unreliability; while budget remains, risky releases proceed; when it is spent, effort moves to reliability until it recovers.
8 — Give three trade-off pairs and one decision that moves each. Important
Answer
Answer: Performance vs maintainability: a hand-tuned cache; security vs usability: mandatory MFA on every login; consistency vs availability: choosing quorum reads or accepting stale replicas during a partition.
9 — What is a sensitivity point and what makes it a trade-off point? Good to know
Answer
Answer: A property critical to achieving a particular quality response (for example encryption strength for confidentiality). It is a trade-off point when it is a sensitivity point for more than one attribute (the same strength also affects latency).
10 — Which smells are in "The system must use Kafka and be user-friendly, etc."? Must-know
Answer
Answer: Solution in requirement (Kafka), subjective language (user-friendly), open-ended term (etc.); it also lacks any measure.
11 — Write a fitness function that keeps the domain layer free of HTTP in Go and in Laravel. Important
Answer
Answer: Go: a test that parses domain/*.go imports and fails on net/http (or go-arch-lint with no allowed dependencies). Laravel: Pest arch('domain')->expect('App\Domain')->not->toUse('Illuminate\Http') or a Deptrac ruleset where Domain has no allowed dependencies.
12 — When does a user story need a use case alongside it? Important
Answer
Answer: When the interaction has many alternative or error flows, regulation requires completeness, or several systems exchange messages; the story stays as the planning token.
Glossary
| Term | Definition |
|---|---|
| Functional requirement | What the system does |
| Non-functional requirement (NFR) | A requirement about how well the system does it; also quality requirement or cross-functional requirement |
| Quality attribute | A named property such as availability, security or modifiability |
| Constraint | A fixed boundary on the design decided outside the team |
| ISO/IEC 25010 | Product and in-use quality model of the SQuaRE series; 2023 edition has nine characteristics |
| Characteristic / sub-characteristic | A top-level quality and its parts in ISO 25010 |
| Functional suitability | ISO characteristic: completeness, correctness, appropriateness of functions |
| Performance efficiency | ISO characteristic: time behaviour, resource utilization, capacity |
| Compatibility | ISO characteristic: co-existence and interoperability |
| Interaction capability | ISO characteristic (formerly usability) covering learnability, operability, inclusivity and more |
| Reliability | ISO characteristic: faultlessness, availability, fault tolerance, recoverability |
| Security | ISO characteristic: confidentiality, integrity, non-repudiation, accountability, authenticity, resistance |
| Maintainability | ISO characteristic: modularity, reusability, analysability, modifiability, testability |
| Flexibility | ISO characteristic (formerly portability): adaptability, scalability, installability, replaceability |
| Safety | ISO characteristic: operational constraint, risk identification, fail safe, hazard warning, safe integration |
| Quality attribute scenario | Six-part, measurable description of a quality requirement |
| Source of stimulus | Entity that generates the stimulus in a scenario |
| Stimulus | Condition that arrives at the system |
| Artifact | The part of the system that is stimulated |
| Environment | Conditions when the stimulus arrives (normal, overload, degraded) |
| Response | What the system does |
| Response measure | The metric that judges the response |
| Latency percentile (p50, p95, p99) | Latency below which that share of requests fall |
| Tail latency | The slowest few percent of requests |
| Throughput | Work completed per unit of time |
| Little's law | In-flight work equals arrival rate times time in system |
| Availability | Share of time or requests in which the service works |
| Nines | Shorthand for availability: three nines is 99.9% |
| RPO | Recovery Point Objective: maximum tolerable data loss in time |
| RTO | Recovery Time Objective: maximum tolerable time to restore service |
| MTTR / MTBF | Mean time to recover / mean time between failures |
| SLI | Service Level Indicator: a measured quantity |
| SLO | Service Level Objective: target for an SLI over a window |
| SLA | Service Level Agreement: contractual SLO with consequences |
| Error budget | Allowed unreliability, 100% minus the SLO |
| Burn rate | Speed at which the error budget is being spent |
| Trade-off point | Property that is a sensitivity point for more than one attribute |
| Sensitivity point | Property critical to achieving a quality response |
| Risk / non-risk | Problematic or sound architectural decision found in ATAM |
| Utility tree | Tree from quality goals down to prioritised scenarios |
| ATAM | Architecture Tradeoff Analysis Method (SEI) |
| ASR | Architecturally significant requirement |
| ADR | Architecture Decision Record |
| Fitness function | Automated check of an architectural quality |
| Evolutionary architecture | Architecture that supports guided, incremental change |
| Requirements smell | Wording that hints at an untestable or ambiguous requirement |
| User story | Short statement of desired functionality, template by Cohn |
| Use case | Goal-oriented description of actor and system interaction with alternatives |
| Job story | Situation, motivation, outcome format |
| Acceptance criteria | Conditions that must hold for a story to be accepted |
| Gherkin | Given-When-Then plain-text specification language of Cucumber |
| Tactic | A single design move that influences a quality |
| Coordinated omission | Load-test artefact that hides tail latency |
| Arch test | Test of dependencies between packages or namespaces (go-arch-lint, Deptrac, Pest arch()) |
References
Every URL below was fetched and returned HTTP 200 unless marked otherwise; the text is saved in the scratchpad sources/quality-attributes-requirements/ folder.
- ISO/IEC 25010 on the ISO/IEC 25000 portal: https://iso25000.com/index.php/en/iso-25000-standards/iso-25010 (the iso.org page https://www.iso.org/standard/78176.html returned 403, so the standard itself was not read).
- Kazman, Klein, Clements, ATAM: Method for Architecture Evaluation, CMU/SEI-2000-TR-004: https://insights.sei.cmu.edu/documents/629/2000_005_001_13706.pdf
- Bass, Clements, Kazman, Software Architecture in Practice, 2nd ed., section 4.3 (course-hosted chapter): https://people.ece.ubc.ca/matei/EECE417/BASS/ch04lev1sec3.html
- Google SRE book, Service Level Objectives: https://sre.google/sre-book/service-level-objectives/
- Google SRE book, Embracing Risk: https://sre.google/sre-book/embracing-risk/
- Google SRE workbook, Implementing SLOs: https://sre.google/workbook/implementing-slos/
- Thoughtworks, Fitness function-driven development: https://www.thoughtworks.com/en-us/insights/articles/fitness-function-driven-development
- Femmer, Méndez Fernández, Wagner, Eder, Rapid Quality Assurance with Requirements Smells: https://arxiv.org/pdf/1611.08847
- Mike Cohn, user stories: https://www.mountaingoatsoftware.com/agile/user-stories and job stories: https://www.mountaingoatsoftware.com/blog/job-stories-offer-a-viable-alternative-to-user-stories
- Intercom, Using job stories to design features: https://www.intercom.com/blog/using-job-stories-design-features-ui-ux/
- Cucumber, Gherkin reference: https://cucumber.io/docs/gherkin/reference/
- Wikipedia, Non-functional requirement: https://en.wikipedia.org/wiki/Non-functional_requirement (secondary source)
- go-arch-lint: https://github.com/fe3dback/go-arch-lint
- Deptrac: https://github.com/deptrac/deptrac and https://deptrac.github.io/deptrac/
- Pest architecture testing: https://pestphp.com/docs/arch-testing
- Laravel 13 helpers (Benchmark): https://laravel.com/docs/13.x/helpers ; rate limiting: https://laravel.com/docs/13.x/rate-limiting
- Not read, cited from general knowledge and labelled as such above: McCall 1977, Boehm 1978, ISO 9126 and the 2011 edition of ISO 25010, Cockburn's use-case book, Bill Wake's INVEST, Gil Tene on coordinated omission, the tactics catalogue chapters of Bass et al., the book Building Evolutionary Architectures itself.