Module 0 β€” Core Concepts

Functional vs Non-Functional Requirements

The "what" vs the "how well". Both are critical for system design success.

1The Car Analogy

πŸ’‘ Simple Analogy
When buying a car, you have two types of needs:

Functional (What it does): Gets you from A to B, has 4 seats, trunk space, AC, radio.

Non-Functional (How well it does it): 0-60 in 5 seconds (performance), 50 MPG (efficiency), 5-star safety rating (reliability), comfortable seats (usability).

A car that "drives" isn't enough. HOW WELL it drives matters for customer satisfaction.

2Functional Requirements

Functional Requirements describe WHAT the system should doβ€”the features, behaviors, and capabilities users expect. They answer: "Can the system do X?"

Examples for Twitter:

βœ“Users can create an account
βœ“Users can post tweets (280 chars)
βœ“Users can follow other users
βœ“Users can like and retweet
βœ“Users can see a timeline of tweets
βœ“Users can search for tweets/users
βœ“Users can send direct messages
βœ“Users can upload images/videos
Interview Tip

Always clarify functional requirements first! Ask: "What are the core features we must support? What can we deprioritize for this discussion?"

3Non-Functional Requirements

Non-Functional Requirements (NFRs) describe HOW WELL the system performsβ€”quality attributes like speed, reliability, and security. They answer: "How fast? How reliable? How secure?"
⚑Performance
  • β€’ Page load < 2 seconds
  • β€’ API response < 100ms
  • β€’ Support 10,000 concurrent users
πŸ“ˆScalability
  • β€’ Handle 10x traffic during peak
  • β€’ Scale from 1M to 100M users
  • β€’ Add capacity without downtime
🟒Availability
  • β€’ 99.99% uptime (4 nines)
  • β€’ No more than 52 minutes downtime/year
  • β€’ Survive single data center failure
πŸ›‘οΈReliability
  • β€’ No data loss ever
  • β€’ Messages delivered at least once
  • β€’ Transactions are atomic
πŸ”’Security
  • β€’ All data encrypted at rest & transit
  • β€’ Authentication required
  • β€’ Rate limiting against abuse
πŸ”§Maintainability
  • β€’ Easy to deploy updates
  • β€’ Clear monitoring & alerting
  • β€’ Well-documented APIs

4Side-by-Side Comparison

AspectFunctionalNon-Functional
FocusWhat the system doesHow well it does it
Example"User can upload photo""Upload completes in <3 sec"
TestingDoes feature work? Yes/NoMeasured with metrics
SourceBusiness/Product teamsEngineering/Operations
ImpactUser featuresUser experience

5Real Example: URL Shortener

Functional Requirements

  • β†’ Given a long URL, generate a short URL
  • β†’ When user visits short URL, redirect to original
  • β†’ Users can create custom short URLs
  • β†’ URLs can have expiration dates
  • β†’ Track click analytics

Non-Functional Requirements

  • β†’ Redirect latency < 50ms
  • β†’ 99.99% availability
  • β†’ Handle 100K redirects/second
  • β†’ Store 100 billion URLs
  • β†’ Short URLs should be unpredictable (security)

6Interview Strategy

1
Ask about scale
"How many users? How many requests per second? How much data?"
2
Clarify availability needs
"What's the acceptable downtime? Is 99.9% enough or do we need 99.99%?"
3
Understand latency requirements
"What response time do users expect? Is this real-time or can it be eventual?"
4
Discuss consistency vs availability
"Is it okay if data is slightly stale? Or must reads always see latest writes?"

7Key Takeaways

1Functional requirements = features (WHAT). Non-functional = quality (HOW WELL).
2Both are equally importantβ€”a fast system with missing features is useless, and vice versa.
3NFRs drive architecture decisions: caching for performance, replication for availability.
4Always quantify NFRs: "fast" is vague, "<100ms p99 latency" is measurable.
5In interviews, ask about both before designing. It shows maturity.
6Trade-offs often exist between NFRs: higher consistency may mean lower availability.