The phone that does everything, badly
A new phone can call, text, play music and take photos. It does everything a phone must do.
But each app takes 10 seconds to open, the battery lasts one hour, and anybody can unlock it.
Would you buy it? No. It does the job, but badly. A requirement is something the software must do or be. A non-functional requirement says how well the software must work.
Key words
| Word | What it means | Example |
|---|---|---|
| Functional requirement | Something the software must do. | send a receipt |
| Non-functional requirement | How well the software must work. | send it in 5 seconds |
| Scalability | How well the software copes as it grows. | 500 users now, 50,000 later |
| Accessibility | Making software usable by people with different needs. | a text description for people who cannot see the picture |
| KPI | A number that shows if the software is doing well enough. | a page loads in 2 seconds |
| Metric | Something you measure in numbers. | milliseconds, users, minutes |
| Millisecond | A thousandth of a second. | 2,000 milliseconds is 2 seconds |
| Acceptance criteria | Checks that must pass before the client accepts the work. | The receipt arrives by email. |
| Spike | A short trial, with a fixed time, to learn something. | 2 days to test a new service |
The cells students fill in are left blank in this preview.
Kinds of non-functional requirement
| Kind | The question | Example with a number |
|---|---|---|
| Security | Who can get in or see data? | Accounts lock after 5 wrong passwords |
| Accessibility | Who can use it? | All text can be made twice as big |
| Scalability | Does it still work when there are many more users? | Works for 500 users now and 5,000 next year |
| Responsiveness | How quick is it? | A page answers in 2 seconds or less |
| Load handling | How many at once? | Works for 500 users at the same time |
| Reliability | How often is it not working? | Down (not working) for no more than 45 minutes a month |
The cells students fill in are left blank in this preview.
Check: what it does or how well
Have a go
Check: what it does or how well
8 questionsCheck: a good requirement has a number
Have a go
Check: a good requirement has a number
3 questionsCheck three KPIs in code
A shop app has three KPIs. Responsiveness: the page answers in 2000 milliseconds or less. Load handling: it must work for 500 users at the same time. Reliability: the system may be down (not working) for no more than 45 minutes in a month. Write four small functions. The last one gives back the list of KPIs that fail. Press Run Tests when you are ready.
def response_ok(response_ms, limit_ms):
# Responsiveness: the page must answer in limit_ms milliseconds or less.
# Give back True or False.
return None
def load_ok(users_now, users_allowed):
# Load handling: the system must cope with users_allowed users at once.
# Give back True if users_now is not more than users_allowed.
return None
def reliable(downtime_minutes, allowed_minutes):
# Reliability: the system may be down for allowed_minutes in a month, no more.
# Give back True if downtime_minutes is within that limit.
return None
def report(response_ms, users_now, downtime_minutes):
# Targets: 2000 milliseconds, 500 users, 45 minutes.
# Give back a list of the names of the KPIs that FAIL, in this order:
# "responsiveness", "load", "reliability". An empty list means all pass.
return None
Make a free account to save your work, or press Start lab to work through the whole lesson.
Acceptance criteria
Acceptance criteria are checks. When all of them pass, the client says: "Yes, this is done."
A simple way to write one is: Given a starting point, When the user does something, Then this should happen.
Acceptance criteria for a password reset
| Given | When | Then |
|---|---|---|
| I forgot my password | I press Reset and type my email | An email arrives within 1 minute |
| The email arrives | I click the link | I can choose a new password |
| I typed an email that has no account | I press Reset | I see the same message, so nobody learns which emails exist |
| The link is more than 1 hour old | I click it | I am told it has expired |
The cells students fill in are left blank in this preview.
Write acceptance criteria for a booking
A cinema app lets customers book a seat.
Write three non-functional requirements with numbers (one about responsiveness, one about load handling, and one about accessibility or security).
Then write four acceptance criteria for "book a seat". Use this template for each:
Given ... When ... Then ...
Example: Given a seat is already taken, When I try to book it, Then I see a message and I cannot book it.
A teacher marks this in a college. Nothing you write here is kept: it goes when you leave the page.
Make a free account to save your work, or press Start lab to work through the whole lesson.
Spike: a short trial to learn
Sometimes you do not know enough to write a requirement. Can a new payment service work with our app? How big is the problem?
A spike is a short trial, with a fixed time. You learn, then you decide.
How a spike works
flowchart TD
a[We are unsure about something] --> b[Set a question and a time limit, for example 2 days]
b --> c[Try a small test or do some research]
c --> d{Did we learn enough?}
d -->|yes| e[Write clear requirements and the scope]
d -->|no| f[Say what is still unknown]
f --> g[Plan another spike or ask the client]
Two meanings of spike
Warning
Many people think a spike is always a load test. In this course, a spike is a short trial before the real build. Some books use "spike testing" for a sudden jump in users. If a question is about finding out what to build, it means the short trial.
Final check
Have a go