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.
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
| Aspect | Functional | Non-Functional |
|---|---|---|
| Focus | What the system does | How well it does it |
| Example | "User can upload photo" | "Upload completes in <3 sec" |
| Testing | Does feature work? Yes/No | Measured with metrics |
| Source | Business/Product teams | Engineering/Operations |
| Impact | User features | User 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.