30 min read Core CS & Systems Part 1 · Lesson 3 (3 / 15)
Part 1 — Mindset & SDLC

Lesson 10.3 — Requirements Engineering

What Are We Actually Building? Turning Ambiguous Ideas into Testable Engineering Contracts

What We Will Master in This Lesson

By the end of this lesson, you will intuitively understand:

  • Why the most fatal bugs occur in requirements, not syntax
  • The Cost-of-Change curve across software lifecycles
  • Authoring User Stories via the INVEST framework
  • Defining acceptance criteria via Given-When-Then syntax
  • Product Requirement Documents (PRDs) and scope boundaries
  • Eliminating linguistic ambiguity to defeat scope creep

1 Where Do the Most Expensive Software Failures Happen?

Many junior developers assume the most catastrophic software bugs are compiler errors, null-pointer dereferences, or off-by-one loops. Decades of empirical software engineering data reveal the opposite:

"There is nothing quite so useless as doing with great efficiency something that should not be done at all."
— Peter F. Drucker

Fixing an ambiguous requirement during the specification phase costs \$1. Fixing that same flaw in design costs \$5. Fixing it after code and unit tests are written costs \$10. But discovering you built the wrong product in production can cost 100x to 1,000x more in corrupted data, emergency rewrites, and lost customer trust.

The Non-Linear Cost-of-Change Curve
Requirements 1x Editing text in a PRD
Design 5x Re-architecting diagrams
Coding & Test 10x Rewriting logic & tests
Production 100x+ DB migrations & reputation hit

2 What is Requirements Engineering?

Requirements Engineering is the disciplined process of discovering, analyzing, documenting, and validating the needs of stakeholders, translating vague desires into precise, unambiguous, and verifiable engineering contracts.

❌ Dangerous, Ambiguous Statement

"The system must load super fast and be completely secure for our users."

Problem: What does "super fast" mean? 1ms or 3 seconds? What does "completely secure" mean? It is impossible to verify or test.
✅ Rigorous Engineering Specification

"99% of search queries must return within 200ms under a load of 1,000 concurrent requests per minute."

Benefit: Clear, empirically measurable, and provable with automated stress tests.

3 User Stories & The INVEST Criteria

Modern agile teams capture business value through User Stories. The canonical template is:

As a [User Persona/Role]
I want to [Action or Capability]
So that [Specific Benefit or Business Value]

Every high-quality user story adheres to the INVEST criteria:

I — Independent

Not tightly coupled to other stories; can be scheduled, built, and shipped in isolation.

N — Negotiable

Not an unalterable contract; leaves room for engineering and product alignment.

V — Valuable

Delivers direct, tangible value to the end customer or business operations.

E — Estimable

Well-enough understood that engineers can estimate complexity and effort.

S — Small

Sized appropriately to be designed, coded, and verified within a single sprint.

T — Testable

Accompanied by explicit acceptance tests to prove completion definitively.

4 Acceptance Criteria: The Definition of "Done"

Disagreements between engineers and product managers almost always stem from vague boundaries. Acceptance Criteria eliminate this ambiguity using the Given-When-Then syntax:

Scenario 1: Successful Checkout with In-Stock Item Given a customer has 1 book in their cart and stock > 0
When they submit payment with valid credit card credentials
Then charge the card, decrement inventory by 1, and dispatch confirmation email.
Scenario 2: Insufficient Funds Failure Given the customer's card has insufficient balance
When they click "Confirm Purchase"
Then do not create an order record, retain cart items, and render a polite error message.

5 🎮 Interactive Simulator: Requirement Ambiguity Detector

Inspect how vague client demands contain hidden architectural traps and see how senior engineers rewrite them into crisp technical specifications:

Select Client Statement:

6 💡 Concept Check (Interactive Quiz)

Test your comprehension of requirements engineering principles:

1. In which lifecycle phase is resolving a misunderstanding or flaw the least expensive?

2. Under the INVEST criteria for user stories, what does the "T" signify?

3. What is the primary purpose of writing acceptance criteria in Given-When-Then format?

7 🧠 Key Takeaways

  • Ambiguity is the enemy: Never accept subjective qualifiers like "fast" or "secure"; demand measurable latency, throughput, and error boundaries.
  • Apply the INVEST framework: Ensure stories are independent, negotiable, valuable, estimable, small, and testable.
  • Define Done upfront: Given-When-Then scenarios provide clear contract targets for both automated test suites and product sign-off.
  • Maintain separation between What and How: Requirements define WHAT the system must achieve; architecture defines HOW it will be structured.
Next Lesson Preview

Lesson 10.4 — Designing Software Before Coding: Architecture, Components & Modularity

With requirements crystal clear, how do you translate them into an architectural blueprint before writing code? We explore components, modules, interfaces, Separation of Concerns, and the power of High Cohesion and Low Coupling.

Start Lesson 10.4