4.5.3Software Engineering

Requirements — functional vs non-functional, user stories, acceptance criteria

2,227 words10 min readdifficulty · medium

1. Why requirements exist at all (WHY)

The cost of fixing a misunderstanding grows roughly exponentially with how late it's caught:

Cost(t)C0kt,k>1\text{Cost}(t) \approx C_0 \cdot k^{\,t}, \quad k > 1

where tt = stage (requirements → design → code → test → production). A requirements-stage fix costing C0C_0 becomes C0k4C_0 k^4 in production. WHY this matters: writing requirements is cheap leverage against the steepest part of this curve.


2. Functional vs Non-Functional (the core split)

Aspect Functional Non-functional
Answers WHAT it does HOW WELL
Example "User can reset password" "Reset email arrives in < 5 s, 99% of time"
Failure looks like Feature missing Feature present but too slow/insecure
Verified by feature test benchmark / load / pen-test
Figure — Requirements — functional vs non-functional, user stories, acceptance criteria

3. User Stories (WHAT — packaged for humans)


4. Acceptance Criteria (the testable definition of "done")

A popular HOW-format is Given-When-Then (Gherkin):

Givencontext/state  Whenaction  Thenexpected outcome\underbrace{\textbf{Given}}_{\text{context/state}}\ \ \underbrace{\textbf{When}}_{\text{action}}\ \ \underbrace{\textbf{Then}}_{\text{expected outcome}}


5. Mistakes (Steel-manned)


6. How they fit together (HOW the workflow runs)

  1. Talk to stakeholders → collect raw needs.
  2. Split each need into FR (verbs) and NFR (measurable qualities).
  3. Package user-facing FRs as user stories (role/goal/benefit), keep them INVEST.
  4. For each story, write acceptance criteria (Given-When-Then) — including edge cases and any NFR thresholds.
  5. Estimate, prioritise by benefit (80/20), build, then verify story is "done" only when all AC pass.

Flashcards

What single question does a functional requirement answer?
WHAT the system must do (a behaviour/feature, a "verb").
What single question does a non-functional requirement answer?
HOW WELL — a measurable quality/constraint (speed, security, availability...).
Give the 3-part user story template.
As a , I want , so that .
Why does a user story include "so that "?
It states the value, acting as the prioritisation/80-20 filter and justifying the cost.
What does the INVEST acronym stand for?
Independent, Negotiable, Valuable, Estimable, Small, Testable.
What is an acceptance criterion?
A specific pass/fail condition a story must meet to be accepted ("definition of done").
Name the three keywords of the Gherkin AC format.
Given (context), When (action), Then (expected outcome).
Where do non-functional thresholds usually become concrete?
In acceptance criteria, as measurable numbers (e.g. "≤ 2 s for 95th percentile").
Why split performance out as non-functional instead of part of the feature?
A feature can be fully present yet too slow; the split forces a measurable target and a different test (load test).
What's wrong with "As a user I want a Redis cache so pages load fast"?
It states a solution (how), not a goal; stories should stay in the problem space and leave design open.
What does FURPS+ remind you to check?
Functionality, Usability, Reliability, Performance, Supportability + security/scalability/legal NFRs.
Why does fixing a requirements error cost so much more in production?
Cost grows roughly exponentially per stage; a wrong assumption propagates into design, code, and tests.

Recall Feynman: explain it to a 12-year-old

Imagine you ask a friend to build you a sandwich. Functional = what goes in it: "bread, cheese, ham." Non-functional = how you want it: "ready in 1 minute, not too salty, cut into triangles." A user story is you saying why: "I'm a hungry kid who wants cheese & ham so I'm not hungry in class." Acceptance criteria are how your friend proves it's right: "Given I gave you bread, when you finish, then there's cheese AND ham, the bread isn't burnt, and it took under a minute." If any of those fails, the sandwich isn't "done" — even if it looks fine!

Connections

  • Software Development Life Cycle — requirements are the first SDLC phase.
  • Agile and Scrum — user stories live in the product backlog.
  • Test-Driven Development — acceptance criteria become automated tests.
  • Software Design — design answers the how that stories deliberately omit.
  • Stakeholder Analysis — the <role> in each story comes from here.
  • Estimation and Story Points — the "Estimable/Small" of INVEST.

Concept Map

justified by

splits into

splits into

is the

is the adverb in

categorised by

packaged as

constrains

made testable by

verified by

Requirements = written agreement on done

Cost grows exponentially if caught late

Functional = WHAT it does

Non-functional = HOW WELL

Verb vs Adverb test

FURPS+ menu of qualities

User stories

Acceptance criteria

Feature and benchmark tests

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, coding shuru karne se pehle do cheezein clear honi chahiye: WHAT system karega aur HOW WELL karega. "What" matlab functional requirement — koi behaviour ya feature, jaise "user password reset kar sakta hai". Ye hamesha ek verb (kaam) hota hai. "How well" matlab non-functional requirement — quality jaise speed, security, reliability. Jaise "reset email 5 second ke andar aaye, 99% baar". Yaad rakho: functional = verb, non-functional = adverb. Same feature ke saath bahut saare NFR chipak sakte hain.

User story ek chhota tarika hai requirement likhne ka jo user-centric ho: "As a , I want , so that ." Isme role real user ko force karta hai, goal capability batata hai (solution nahi!), aur so that value batata hai — yahi 80/20 filter hai, agar benefit nahi likh paa rahe to feature shayad bekaar hai. Ek galti jo sab karte hain: story me solution daal dena ("I want a Redis cache"). Galat! Story sirf problem batati hai, how baad me design wale decide karenge.

Acceptance criteria wo precise pass/fail conditions hain jo batati hain ki story "done" kab hui. Iska famous format hai Given-When-Then: Given = context/state, When = action, Then = expected result. Aur yahin par non-functional ke numbers concrete hote hain (jaise "≤ 2 seconds"). Sabse important tip: sirf happy-path mat likho — empty cart, invalid input, boundary cases zaroor add karo, kyunki asli bugs wahin chhupte hain.

Ye sab matter kyun karta hai? Kyunki galti requirements stage me 1 rupaye ki hai, lekin production me wahi galti hazaar rupaye ki ho jaati hai — cost har stage pe roughly exponentially badhti hai. To thoda time requirements likhne me lagao, baad me bahut paisa aur dimaag bachega.

Go deeper — visual, from zero

Test yourself — Software Engineering