<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Niyati Nehal</title>
    <description>The latest articles on DEV Community by Niyati Nehal (@niyatinehal).</description>
    <link>https://dev.to/niyatinehal</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4129277%2F603e62dd-20ce-4a56-9372-822750520002.png</url>
      <title>DEV Community: Niyati Nehal</title>
      <link>https://dev.to/niyatinehal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/niyatinehal"/>
    <language>en</language>
    <item>
      <title>Everyone Says “Clarify the Requirements” in System Design. But How?</title>
      <dc:creator>Niyati Nehal</dc:creator>
      <pubDate>Thu, 17 Sep 2026 07:16:33 +0000</pubDate>
      <link>https://dev.to/niyatinehal/everyone-says-clarify-the-requirements-in-system-design-but-how-33pf</link>
      <guid>https://dev.to/niyatinehal/everyone-says-clarify-the-requirements-in-system-design-but-how-33pf</guid>
      <description>&lt;p&gt;You all might have watched a lot of YouTube videos on system design and heard almost every one of them say:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Before you start designing, clarify the functional and non-functional requirements.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;And yes, obviously.&lt;br&gt;
You’re supposed to clarify the requirements.&lt;br&gt;
But how do you actually do that?&lt;br&gt;
What exactly do you ask the interviewer?&lt;br&gt;
How do you know whether the question you’re asking is useful?&lt;/p&gt;

&lt;p&gt;How do you go from:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Design a URL shortener”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;to actually knowing what you’re supposed to build?&lt;br&gt;
I think this is one of those things that sounds very obvious when someone explains it after the fact, but when you’re actually sitting in an interview, it’s much harder.&lt;/p&gt;

&lt;p&gt;So I wanted to break down the five things we usually hear about:&lt;/p&gt;

&lt;p&gt;1-Functional and non-functional requirements&lt;br&gt;
2-API design&lt;br&gt;
3-High-level design|&lt;br&gt;
4-Database design&lt;br&gt;
5-Detailed design&lt;/p&gt;

&lt;p&gt;But not as a checklist.&lt;/p&gt;

&lt;p&gt;More importantly, how do you arrive at each of these? What questions do you ask, and why?&lt;br&gt;
First: Don’t Start Designing&lt;/p&gt;

&lt;p&gt;The interviewer says:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Design a URL shortener.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;My brain might immediately go:&lt;br&gt;
“Okay, Redis, database, load balancer…”&lt;/p&gt;

&lt;p&gt;But wait.&lt;br&gt;
I don’t even know what I’m designing yet.&lt;br&gt;
The problem statement is intentionally vague.&lt;br&gt;
So the first thing I’m actually trying to do is:&lt;br&gt;
remove ambiguity.&lt;/p&gt;

&lt;p&gt;I want to turn:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Design a URL shortener”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;into something more like:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“We’re building a URL-shortening service for authenticated users, supporting URL creation and redirection, with X traffic, Y latency requirements, and Z availability requirements.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now I have something I can actually design.&lt;br&gt;
And this is where those five things come in.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Functional Requirements: What Does the User Actually Need to Do?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The usual advice is:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Clarify the functional requirements.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Okay.&lt;br&gt;
But I don’t want to ask the interviewer:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“What are the functional requirements?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;That’s technically correct, but it doesn’t really help me think.&lt;br&gt;
I’d rather start with:&lt;br&gt;
Who is using the system?&lt;/p&gt;

&lt;p&gt;For a URL shortener:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Are users authenticated, or can anyone create a short URL anonymously?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;That one question already changes things.&lt;br&gt;
If users are authenticated, I might need:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;user accounts
ownership
authorization
URL management
user-specific limits
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If it’s anonymous, a lot of that disappears.&lt;br&gt;
So I’m not asking questions just to collect information.&lt;br&gt;
I’m asking:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“What information could actually change my design?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Then ask: What can the user actually do?&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Is the requirement only to create and redirect short URLs, or do we also need expiration, custom aliases, analytics, deletion, etc.?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Because “URL shortener” could mean a very simple service.&lt;br&gt;
Or it could mean:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;create URLs
delete URLs
custom aliases
expiration
analytics
user dashboard
authentication
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;I need to know where the boundary is.&lt;br&gt;
And this applies to every system.&lt;br&gt;
If someone says:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Design Instagram.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;That could mean the entire Instagram product.&lt;br&gt;
Obviously we’re not designing all of Instagram in an interview.&lt;br&gt;
So I need to establish the scope.&lt;br&gt;
Find the Main User Journey&lt;/p&gt;

&lt;p&gt;Once I know the scope, I want to understand the most important thing the user is trying to do.&lt;/p&gt;

&lt;p&gt;For a URL shortener:&lt;/p&gt;

&lt;p&gt;User&lt;br&gt;
 ↓&lt;br&gt;
Submits long URL&lt;br&gt;
 ↓&lt;br&gt;
System generates short code&lt;br&gt;
 ↓&lt;br&gt;
User gets short URL&lt;br&gt;
 ↓&lt;br&gt;
Someone opens short URL&lt;br&gt;
 ↓&lt;br&gt;
System finds original URL&lt;br&gt;
 ↓&lt;br&gt;
User is redirected&lt;/p&gt;

&lt;p&gt;That’s the core flow.&lt;br&gt;
Now I have something around which I can start thinking.&lt;br&gt;
And this gives me a useful rule:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Don’t try to understand every possible feature first. Find the primary user journey.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;Non-Functional Requirements: How Well Does It Need to Work?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Okay, now I know what the system does.&lt;/p&gt;

&lt;p&gt;The next question is:&lt;br&gt;
How well does it need to do it?&lt;/p&gt;

&lt;p&gt;This is where non-functional requirements come in.&lt;br&gt;
And again, I don’t want to ask:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“What are the NFRs?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;I want to ask questions that reveal the constraints.&lt;br&gt;
How much traffic?&lt;br&gt;
Suppose the interviewer says:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“We have millions of users.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Cool.&lt;br&gt;
But that doesn’t tell me much.&lt;br&gt;
Millions of users doesn’t mean millions of requests per second.&lt;br&gt;
So I’d ask:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“How many daily active users are we expecting?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Approximately how many requests per second?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“What’s the read-to-write ratio?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;And:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Is that average traffic or peak traffic?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Suppose I get:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1,000 URL creations/sec
100,000 redirects/sec
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now I know something important.&lt;br&gt;
The system is very read-heavy.&lt;br&gt;
That immediately makes things like caching and read scaling relevant.&lt;br&gt;
Notice what happened:&lt;br&gt;
I didn’t decide:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Let’s use Redis.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The traffic requirement led me toward that discussion.&lt;br&gt;
What About Latency?&lt;/p&gt;

&lt;p&gt;Instead of vaguely asking:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“What’s the latency requirement?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;I can ask something more concrete:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“For the redirect operation, are we okay with something like 100 ms, or do we need it to be closer to tens of milliseconds?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now I can start thinking about what belongs in the critical path.&lt;br&gt;
If something is expensive but doesn’t need to happen before the user receives a response, maybe it can happen asynchronously.&lt;br&gt;
Again:&lt;/p&gt;

&lt;p&gt;Requirement → consequence → architecture.&lt;br&gt;
What Absolutely Needs to Work?&lt;/p&gt;

&lt;p&gt;Availability is another thing I don’t want to treat as a number in isolation.&lt;/p&gt;

&lt;p&gt;I can ask:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“If the analytics system is temporarily unavailable, should URL redirection still work?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If the interviewer says yes, then I’ve learned something important:&lt;/p&gt;

&lt;p&gt;Redirection is critical. Analytics isn’t.&lt;/p&gt;

&lt;p&gt;So maybe analytics shouldn’t be part of the synchronous redirect path.&lt;br&gt;
Maybe I can process analytics asynchronously.&lt;br&gt;
That’s a much more useful way of thinking about availability than simply memorizing:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“The system should have 99.99% availability.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;And Then There’s Consistency&lt;/p&gt;

&lt;p&gt;One question I like here is:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“What happens if two users temporarily see different values?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Because not everything needs the same consistency guarantees.&lt;br&gt;
A social-media like count being slightly stale might be acceptable.&lt;br&gt;
A bank balance being wrong is a very different problem.&lt;br&gt;
So instead of memorizing:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“This uses eventual consistency and this uses strong consistency.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Ask:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“What happens if the data is temporarily inconsistent?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The answer tells me how strong my consistency requirements actually need to be.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;API Design: Don’t Just Design Endpoints&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now that I understand what the system needs to do, I can think about:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;How does the outside world interact with it?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Suppose I need to create a short URL.&lt;br&gt;
First ask:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“What does the client need to send?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Probably:&lt;/p&gt;

&lt;p&gt;{&lt;br&gt;
  "url": "&lt;a href="https://example.com" rel="noopener noreferrer"&gt;https://example.com&lt;/a&gt;"&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“What does the client need back?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Maybe:&lt;/p&gt;

&lt;p&gt;{&lt;br&gt;
  "shortUrl": "&lt;a href="https://short.ly/abc123" rel="noopener noreferrer"&gt;https://short.ly/abc123&lt;/a&gt;"&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Only now does something like:&lt;/p&gt;

&lt;p&gt;POST /urls&lt;/p&gt;

&lt;p&gt;start making sense.&lt;br&gt;
I’m not inventing the endpoint.&lt;br&gt;
I’m deriving it from the user action.&lt;br&gt;
But Don’t Stop at the Happy Path&lt;/p&gt;

&lt;p&gt;For every important API, I want to ask:&lt;br&gt;
What is the action?&lt;/p&gt;

&lt;p&gt;Create a short URL.&lt;br&gt;
What information does it need?&lt;/p&gt;

&lt;p&gt;The original URL.&lt;br&gt;
What does it return?&lt;/p&gt;

&lt;p&gt;The generated short URL.&lt;br&gt;
What can go wrong?&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Invalid URL
Rate limit
Duplicate request
Service failure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;And then one of my favourite questions:&lt;br&gt;
What happens if the client retries?&lt;/p&gt;

&lt;p&gt;Imagine this:&lt;br&gt;
Become a Medium member&lt;/p&gt;

&lt;p&gt;The client sends a request.&lt;br&gt;
The server successfully creates the short URL.&lt;br&gt;
But the response gets lost.&lt;br&gt;
The client doesn’t know whether the request succeeded.&lt;br&gt;
So it sends the request again.&lt;br&gt;
What happens?&lt;br&gt;
Do we create another short URL?&lt;br&gt;
Or do we return the previous result?&lt;br&gt;
Now we’ve naturally arrived at:&lt;/p&gt;

&lt;p&gt;idempotency.&lt;/p&gt;

&lt;p&gt;This is why I don’t think API design should just be:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Let’s design some REST endpoints.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The API is where the system’s behaviour starts becoming explicit.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;HLD: Stop Drawing Boxes Just Because You Know Them&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is probably where I’ve seen the most “system design interview diagrams.”&lt;/p&gt;

&lt;p&gt;Something like:&lt;/p&gt;

&lt;p&gt;Client&lt;br&gt;
 ↓&lt;br&gt;
Load Balancer&lt;br&gt;
 ↓&lt;br&gt;
API Gateway&lt;br&gt;
 ↓&lt;br&gt;
Microservices&lt;br&gt;
 ↓&lt;br&gt;
Redis&lt;br&gt;
 ↓&lt;br&gt;
Kafka&lt;br&gt;
 ↓&lt;br&gt;
Database&lt;/p&gt;

&lt;p&gt;And then everyone nods because it looks like a system.&lt;br&gt;
But the interviewer can simply ask:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Why do you need Kafka?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;And suddenly we’re in trouble.&lt;br&gt;
So I’ve started thinking about HLD differently.&lt;br&gt;
Before adding a component, ask:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;What problem does this component solve?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Example: Why would I need a queue?&lt;/p&gt;

&lt;p&gt;Suppose I’m designing a video-sharing platform.&lt;br&gt;
Video processing can take a long time.&lt;br&gt;
I don’t want the user to sit there waiting for:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;transcoding
generating different resolutions
thumbnails
metadata processing
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;So I might design:&lt;/p&gt;

&lt;p&gt;Upload&lt;br&gt;
 ↓&lt;br&gt;
Object Storage&lt;br&gt;
 ↓&lt;br&gt;
Create Processing Job&lt;br&gt;
 ↓&lt;br&gt;
Queue&lt;br&gt;
 ↓&lt;br&gt;
Workers&lt;br&gt;
 ↓&lt;br&gt;
Processed Videos&lt;/p&gt;

&lt;p&gt;Now the queue has a reason to exist.&lt;br&gt;
It’s not there because:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Kafka is something senior engineers use.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;It’s there because:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I have expensive work that doesn’t need to block the user’s request.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;That’s the kind of explanation I want to be able to give.&lt;br&gt;
Every Box Should Have a “Why”&lt;/p&gt;

&lt;p&gt;If I draw Redis:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Why?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Because the data is frequently read and can be cached.&lt;br&gt;
If I draw Kafka:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Why?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Because work can happen asynchronously and doesn’t need to block the request.&lt;br&gt;
If I draw a separate service:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Why?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Because it has a separate responsibility, scaling requirement, or failure boundary.&lt;br&gt;
If I can’t explain why a component exists, maybe I shouldn’t have drawn it.&lt;/p&gt;

&lt;p&gt;So my rule here is:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Architecture should be the consequence of requirements, not a collection of technologies I remember.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;Database Design: Don’t Start With “SQL or NoSQL?”&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is another place where I think it’s easy to jump to the wrong question.&lt;/p&gt;

&lt;p&gt;Instead of:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Should I use PostgreSQL or MongoDB?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Start with:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;What information does the system actually need to remember?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For a URL shortener:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;original URL
short code
user
creation time
expiration time
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Then ask:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;How do I need to access this information?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Maybe the most important query is:&lt;/p&gt;

&lt;p&gt;shortCode → originalURL&lt;/p&gt;

&lt;p&gt;That’s more useful to me than immediately debating databases.&lt;/p&gt;

&lt;p&gt;Then I can ask:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;How often do we run this query?
How much data will we have?
How quickly will it grow?
What relationships exist?
Do we need transactions?
What consistency do we need?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Only after answering these questions should I start thinking about the storage technology.&lt;br&gt;
So the mental sequence becomes:&lt;/p&gt;

&lt;p&gt;Data → relationships → queries → query frequency → scale → consistency → storage choice&lt;/p&gt;

&lt;p&gt;Not:&lt;/p&gt;

&lt;p&gt;Problem → MongoDB because it’s scalable.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Detailed Design: Where Is the Interesting Problem?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;At this point, I should know:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;what we’re building
who uses it
how much traffic we have
what the important APIs are
what the major components are
what data we store
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now I can zoom in.&lt;br&gt;
But I don’t need to explain every single class or function.&lt;br&gt;
Instead, ask:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;What’s the hardest part of this system?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For a URL shortener, maybe it’s:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“How do we generate unique short codes when multiple servers are creating URLs at the same time?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now we can go deeper.&lt;/p&gt;

&lt;p&gt;Request&lt;br&gt;
 ↓&lt;br&gt;
Generate unique ID&lt;br&gt;
 ↓&lt;br&gt;
Base62 encoding&lt;br&gt;
 ↓&lt;br&gt;
Short code&lt;br&gt;
 ↓&lt;br&gt;
Store mapping&lt;/p&gt;

&lt;p&gt;And now more questions appear:&lt;br&gt;
What if two servers generate the same ID?&lt;br&gt;
Can IDs be generated independently?&lt;br&gt;
Do we need a centralized ID generator?&lt;br&gt;
What happens if the ID generator goes down?&lt;br&gt;
What happens if two identical requests arrive simultaneously?&lt;br&gt;
Now I’m actually doing detailed system design.&lt;br&gt;
The Most Important Thing: Every Answer Should Create the Next Question&lt;/p&gt;

&lt;p&gt;This is probably the biggest thing I’m taking away from all of this.&lt;/p&gt;

&lt;p&gt;System design shouldn’t feel like:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Question → answer → next section.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;It should feel like:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Question → answer → consequence → next question → design decision
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;The interviewer says:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“We expect 1 million requests per second.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;I ask:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Are those mostly reads or writes?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;They say:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Mostly reads.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;I ask:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Can the data be cached?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;They say:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Yes, it doesn’t change frequently.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now I think:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Okay, caching can reduce the load on the database.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Then I ask:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“What happens on a cache miss?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now I’m thinking about the database.&lt;/p&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Can the database handle the remaining traffic?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If not:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Can we use read replicas?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Notice how the architecture is slowly appearing.&lt;br&gt;
I didn’t start with:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“Let’s use Redis.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The requirement led me there.&lt;br&gt;
So What Are the Five Things Actually Doing?&lt;/p&gt;

&lt;p&gt;Maybe this is the easiest way for me to remember them.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Functional requirements&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What are we building?&lt;br&gt;
Who uses it?&lt;br&gt;
What can they do?&lt;br&gt;
What is the main user journey?&lt;br&gt;
What’s in scope?&lt;br&gt;
What’s out of scope?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Non-functional requirements&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;How well does it need to work?&lt;br&gt;
How much traffic?&lt;br&gt;
How much data?&lt;br&gt;
What latency?&lt;br&gt;
What availability?&lt;br&gt;
What consistency?&lt;br&gt;
What happens during failures?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;API design&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;How does the outside world interact with it?&lt;br&gt;
What does the client send?&lt;br&gt;
What does it receive?&lt;br&gt;
What can go wrong?&lt;br&gt;
What happens on retries?&lt;br&gt;
Is it idempotent?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;HLD&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What pieces do I need, and why?&lt;br&gt;
Cache?&lt;br&gt;
Queue?&lt;br&gt;
Database?&lt;br&gt;
Workers?&lt;br&gt;
Services?&lt;br&gt;
Load balancer?&lt;br&gt;
And most importantly:&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Database + detailed design&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;How does the system actually store and process information?&lt;br&gt;
What are the entities?&lt;br&gt;
What are the important queries?&lt;br&gt;
What happens under concurrency?&lt;br&gt;
What happens when something fails?&lt;br&gt;
Where is the bottleneck?&lt;br&gt;
The Question I Want to Keep Beside Me&lt;/p&gt;

&lt;p&gt;I don’t think I need to memorize a giant list of system-design questions.&lt;br&gt;
I just need to keep asking:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“What do I need to know before I can make this decision?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;I need to choose a database?&lt;br&gt;
First understand the data and access patterns.&lt;br&gt;
I need to add Redis?&lt;br&gt;
First understand whether caching solves an actual problem.&lt;br&gt;
I need Kafka?&lt;br&gt;
First understand whether something should be asynchronous.&lt;br&gt;
I need a read replica?&lt;br&gt;
First understand the read volume and database bottleneck.&lt;br&gt;
I need strong consistency?&lt;br&gt;
First understand what happens if users temporarily see different data.&lt;br&gt;
That’s probably the biggest shift in how I want to approach system design.&lt;br&gt;
Not:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“What architecture do I know for this problem?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;But:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;“What questions do I need to answer so that the architecture becomes obvious?”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;And honestly, that’s probably what I should be practicing when I practice system design.&lt;br&gt;
Not drawing more diagrams.&lt;br&gt;
Getting better at asking the next useful question&lt;/p&gt;

</description>
      <category>career</category>
      <category>interview</category>
      <category>softwareengineering</category>
      <category>systemdesign</category>
    </item>
  </channel>
</rss>
