Sub topic 18
Common mistakes and how to avoid them
This chapter assumes you have read the earlier chapters. You should know the difference between functional and non-functional requirements. You should also know what SLIs and SLOs are, and you should be able to read short Python snippets.
Mistakes in how requirements are written
Vague quality words
"The service must be fast and scalable" cannot be tested. Nobody can say whether 300 ms is fast. Replace each quality word with a number, a percentile, a measurement point and a time window. Compare with NFR-1 from the URL shortener: "99% of redirects complete in under 100 ms, measured at the service edge over 30 days."
You can catch this mistake automatically. The script below flags words that usually hide a missing target.
VAGUE_WORDS = {"fast", "scalable", "reliable", "secure", "robust", "user-friendly"}
def vague_words(requirement):
"""Return the vague quality words found in a requirement."""
words = {w.strip(".,;:").lower() for w in requirement.split()}
return sorted(words & VAGUE_WORDS)
print(vague_words("The service must be fast and scalable.")) # ['fast', 'scalable']
print(vague_words("99% of redirects complete in under 100 ms.")) # []Mixing requirement types
A single line such as "Users can upload photos quickly" combines a function (upload) with a quality (quickly). Split it into a functional requirement and a separate non-functional one. Each can then be tested and owned on its own.
Averages instead of percentiles
An average hides slow outliers. In the percentile example, the median was 20 ms while the 99th percentile was 250 ms. State latency targets as percentiles.
Mistakes in scope and planning
- Skipping out-of-scope items. Unlisted features creep back in. Write them down, as the URL shortener does with click analytics.
- Hidden assumptions. If you assume 10 million daily users, record it. Your capacity estimate is only as good as that number.
- Asking for maximum everything. 99.99% availability, strong consistency and the lowest latency cannot all be bought cheaply together. Rank the requirements and accept the trade-offs.
- Estimating peak load from the average. An average of 2,315 requests per second is not the load to size for. Apply a peak factor, as in the capacity example.
- Designing before the requirements exist. Choosing a database first forces the requirements to fit it.
Mistakes in checking
Requirements that no one validates drift. Review each one for clarity, testability and consistency with the others. Two targets can contradict each other, for example synchronous replication to three regions alongside a 20 ms write latency.
Exercise
Rewrite "The checkout page must load quickly and let users pay by card" as two testable requirements.
Show answer
Functional: a user can pay for an order by card on the checkout page. Non-functional: 95% of checkout page loads complete in under 800 ms, measured at the client over 30 days. The two parts are separate, and the quality target has a percentile, a threshold and a window.