Knowledge Base · Learning paths
System Design for Beginners: Start with HLD and LLD
This beginner-friendly guide explains the core differences between High-Level Design (HLD) and Low-Level Design (LLD), key concepts like latency, throughput, and scalability, and provides a clear learning path. It helps developers with no prior experience build a solid foundation in system design without getting overwhelmed by complex diagrams.
Translated from Chinese by AI. Spotted an issue? Use the feedback button.
🔗 Original source: System Design for Beginners: How to Start With HLD and LLD
Harshit Khosla · X · @Harry_The_Nerd · 2026-09-13 16:11
📌 This article is a repost. Copyright belongs to the original author. Please refer to the original link for the authoritative version.
Introduction
If you have ever opened a system design article and immediately felt lost, you are not alone. Most resources jump straight into complex diagrams filled with load balancers, message queues, and databases, without ever explaining why these things matter or where to begin.
This guide is written for exactly that situation. It assumes you have no prior knowledge of system design. By the end, you will understand what high-level design (HLD) and low-level design (LLD) actually mean, how they differ, which concepts you need to learn for each, and how to start practicing without feeling overwhelmed.
This is not a shortcut to becoming a system design expert overnight. It is a map that shows you where to start, what to learn next, and why each part matters.
What System Design Actually Is
At its core, system design is about deciding how a software system should be built so that it works correctly, handles the expected load, and can scale over time without breaking down.
Think about an app like Instagram. Every second, millions of people upload photos, browse their feeds, and send messages. None of this happens by accident. Someone has to make deliberate decisions about how data flows through the system, where it is stored, how it is retrieved quickly, and what happens when part of the system fails.
System design falls into two broad categories. Understanding this distinction early will save you a lot of confusion.
High-Level Design (HLD)
HLD is the big-picture view of a system. It answers questions such as:
-
What are the system’s main components?
-
How do these components communicate with one another?
-
Where is data stored, and why was that choice made?
-
How does the system handle millions of users rather than just a handful?
-
What happens when something fails?
If someone asked you to design Twitter at a high level, you would think about how tweets are stored, how feeds are generated for millions of users, and how the system stays fast under heavy load. You would not be thinking about class structures or specific functions. That comes later.
Low-Level Design (LLD)
LLD is the detailed, code-level view of a system. Once you understand the big picture, LLD answers questions such as:
-
What classes and objects should exist?
-
How should these classes interact?
-
Which design patterns will make the code flexible and maintainable?
-
How should the code be organized so that it can be extended later without breaking everything?
If HLD is the blueprint for a building, LLD is the detailed plan for the wiring, plumbing, and finishes in each room. Both are essential. A building with an excellent blueprint but poor internal wiring will still have problems. The same is true of a system with a strong architecture but messy, hard-to-maintain code.
Why Beginners Should Learn Both
One common mistake beginners make is choosing one and ignoring the other. Some focus entirely on HLD because it feels more exciting, full of buzzwords like Kafka, Redis, and Cassandra. Others focus entirely on LLD because it feels closer to actual coding.
The truth is that real systems need both. A system with a well-designed architecture but poorly structured code will become difficult to maintain. A system with clean code but a flawed architecture will not scale either. This guide treats HLD and LLD as two halves of the same skill, because that is exactly what they are.
HLD Fundamentals, Fully Expanded (A Comprehensive Guide to HLD Basics)
How a Request Actually Reaches a Server
Before diving into load balancers and databases, it helps to understand what physically happens when you type a URL into your browser, because almost every HLD concept builds on this process.
A server is simply a machine, physical or virtual, that runs your application code and waits for requests. When you type an address like www.example.com into your browser, your computer does not know where that server actually is. It first contacts a DNS server. DNS stands for Domain Name System, and it acts like the internet’s phone book. DNS translates a human-readable name (example.com) into the server’s actual IP address, such as 142.250.196.14.
Once the browser has the IP address, it sends a request directly to that address. The server may be running many programs at once, so the request also specifies a port number to tell the server which application should handle it. Port 443 is the standard port for secure web traffic, while port 80 is the standard port for ordinary web traffic. The server receives the request on that port, processes it, and sends a response back in much the same way.
This entire round trip, from the browser sending a request to receiving a response, is the foundation that everything else in system design aims to optimize. Every concept you learn from here on—caching, load balancing, CDNs—is intended to make this cycle faster, more reliable, or capable of handling more traffic.
Real-world example: When you search on Google, your browser first uses DNS to resolve google.com to an IP address, then sends a request to that IP on port 443. Google’s servers receive the request, process your query through their search infrastructure, and return a response that your browser renders as the search results page you see.
Latency and Throughput
These two terms come up frequently, and beginners often confuse them, so it is worth drawing a clear distinction.
Latency is the time it takes to complete a single request, usually measured in milliseconds. If you click a button and the page updates within 200 milliseconds, that is the latency of the operation. Lower latency means a faster, more responsive experience.
Throughput is the number of requests a system can handle in a given period, usually measured in requests per second. A server might be able to handle 5,000 requests per second before it starts to struggle. That number is its throughput.
Here is one way to tell them apart. Imagine a highway. Latency is the time it takes a particular car to travel from one end to the other. Throughput is the number of cars that can pass through the highway in an hour. A highway may offer low latency for an individual car, but if it has only one lane, its throughput may still be low. In system design, you ideally want both: fast individual requests and the ability to handle many concurrent requests.
Real-world example: A stock trading platform cares deeply about latency because even a 50-millisecond delay in executing a trade can cost the firm money. A bulk email service, by contrast, cares more about throughput because it needs to send millions of emails within a few hours; a slight delay in any individual email does not matter.
Scaling and Its Types
As your application gains more users, your existing setup will eventually struggle to keep up with demand, and the system will need to scale. There are two fundamental ways to do this.
Vertical scaling means making your existing server more powerful. You add more CPUs, more memory, or faster storage to the same machine. This is straightforward because your application logic does not need to change at all—you are simply running it on more powerful hardware. The problem is that vertical scaling has a ceiling. There are physical and financial limits to how powerful a single machine can be, and eventually you cannot scale it up any further.
Horizontal scaling means adding more servers rather than making one server more powerful, then distributing incoming traffic across all of them. This approach can scale far beyond vertical scaling, but it introduces complexity: you now have multiple servers and need a way to share the load. This is where load balancers come in.
As a general rule, beginners designing large systems should default to thinking in terms of horizontal scaling. Almost every major platform you use daily, from Instagram to Amazon, runs on horizontally scaled server clusters rather than a single giant machine.
Real-world example: A small SaaS startup with only a few hundred users may run comfortably on a single reasonably powerful server, scaling vertically as needed. Once that same startup grows to millions of users, like Slack or Notion, a single server physically cannot scale any further, forcing a move to horizontal scaling across multiple servers.
Autoscaling
Traffic is not constant for most applications. A food delivery app receives far more traffic at lunch and dinner than at four in the morning. If you provision enough servers to handle the absolute peak and keep them running around the clock, you end up paying for a lot of idle capacity during quieter periods.
Autoscaling solves this problem by automatically adding or removing servers based on real-time demand. If your servers’ CPU utilization exceeds a threshold, say 80%, the system automatically starts additional servers and begins routing traffic to them. When traffic drops again, those extra servers are automatically shut down to save costs.
This is why cloud platforms like AWS, GCP, and Azure are so widely used. You configure these rules once, and the infrastructure automatically handles scaling up and down, without anyone having to watch dashboards at 2 a.m.
Real-world example: Ticket-booking platforms like BookMyShow or Ticketmaster experience huge traffic spikes the moment tickets for a popular concert go on sale, followed by an almost complete lull. Autoscaling lets them spin up extra servers only during that sales window and scale back down afterward, rather than paying for peak capacity all year round.
Back-of-the-Envelope Estimation
Before designing a system, especially in an interview setting, it helps to roughly estimate the scale you are designing for. You do not need precise numbers; the goal is simply to understand the order of magnitude you are dealing with.
Suppose you are designing a photo-sharing app with 50 million daily active users, each uploading an average of 2 photos per day. That works out to roughly 100 million photo uploads per day. If each photo averages 3 megabytes, you will need about 300 TB of new storage every day. Suddenly, a decision like “Should we store photos in a regular database?” becomes an obvious mistake, naturally steering you toward dedicated object storage.
These quick calculations do not need to be perfect. Their entire purpose is to force you to confront the actual scale of the problem early, grounding your design decisions in reality rather than guesswork.
Let’s work through the numbers for the same photo-sharing app in full, rather than just estimating them in our heads.
Given:
-
50 million daily active users
-
Each user uploads 2 photos per day
-
Each user views 100 photos per day
-
Average photo size is 3 MB
-
10% of photos also receive one comment
Step 1: Calculate Daily Writes
Total daily photo uploads = 50,000,000 users x 2 photos = 100,000,000 uploads per day
Step 2: Calculate Daily Reads
Total daily photo views = 50,000,000 users x 100 views = 5,000,000,000 views per day
This alone tells you something important: reads outnumber writes by 50 to 1. That is a strong signal that caching and read replicas will matter far more here than optimizing writes.
Step 3: Calculate Daily Storage Requirements
Daily storage = 100,000,000 uploads x 3 MB = 300,000,000 MB = 300 TB per day
Step 4: Calculate Annual Storage Requirements
Annual storage = 300 TB x 365 = approximately 109,500 TB = approximately 109.5 PB per year
Step 5: Calculate Requests per Second
Uploads per second = 100,000,000 / 86,400 seconds in a day = approximately 1,157 uploads per second
Views per second = 5,000,000,000 / 86,400 = approximately 57,870 views per second
What This Tells Us:
With numbers like these, a single database server is immediately ruled out, both in terms of storage and request volume. The huge gap between reads and writes tells us to invest heavily in photo caching and CDN delivery, while the storage requirements tell us that the photos themselves belong in dedicated object storage like S3, not a traditional database. That is the whole point of back-of-the-envelope estimation: it turns a vague sense of scale into concrete architectural decisions.
A Closer Look at Load Balancers
Once you have multiple servers, you need something to decide which server handles each incoming request. That is the job of a load balancer, which sits directly in front of your server cluster.
Load balancers can use several common strategies.
Round robin sends requests to servers in a repeating sequence: server one, then server two, then server three, and back to server one. It is simple and works well when all servers have similar capacity.
servers = [server1, server2, server3]
currentIndex = 0
function getNextServer():
server = servers[currentIndex]
currentIndex = (currentIndex + 1) % length(servers)
return server
Least connections sends each new request to the server with the fewest active connections. This works better than round robin when some requests take longer to process than others, because it avoids piling more work onto a server that is already handling long-running requests.
servers = [server1, server2, server3]
activeConnections = { server1: 4, server2: 1, server3: 7 }
function getNextServer():
return server with minimum value in activeConnections
// after routing a request to that server:
activeConnections[chosenServer] += 1
// once that request finishes:
activeConnections[chosenServer] -= 1
IP hashing generates a value from a client’s IP address and consistently routes that client to the same server. This is important when a server temporarily holds session information for a particular user: their requests need to keep reaching the same machine.
For a concrete example, if a food delivery platform experiences a sudden traffic spike during a major promotion, a load balancer can prevent that spike from overwhelming any single server. Rather than letting one server try to handle everything and crash, the load balancer spreads incoming traffic across dozens of servers running in parallel, keeping the application responsive for everyone.
Real-world example: Amazon’s Elastic Load Balancer sits in front of thousands of backend servers during events such as Black Friday, distributing incoming shopping traffic to ensure that no server handling checkout requests gets overwhelmed while others sit idle.
Databases, SQL, and NoSQL
Choosing the right type of database is one of the most consequential decisions in system design, and the choice usually comes down to two broad categories.
Relational databases, such as PostgreSQL and MySQL, organize data into structured tables with predefined columns and strict relationships between tables. They enforce what are known as ACID properties, ensuring that transactions are handled reliably even if they fail midway through. This makes them ideal for scenarios where correctness matters more than raw write speed, such as storing users’ bank balances or e-commerce order histories, where inconsistent or lost data is simply unacceptable.
NoSQL databases, such as MongoDB, Cassandra, or DynamoDB, trade some of that strict structure and consistency for flexibility and massive write throughput. They do not require a fixed schema, meaning you can store records with different fields without redefining the table structure each time. This makes them well suited to high-volume, less structured data, such as social media feeds, chat messages, or sensor data from millions of devices.
When to Use Which Database
Knowing that SQL and NoSQL exist is not enough. The real skill is knowing which one fits a particular situation, and that decision usually comes down to a few specific questions you should ask about your data.
Q: Does my data have complex relationships?
If your data naturally involves multiple related entities that need to be joined, such as users, orders, products, and payments in an e-commerce system, a relational database is usually the better choice. SQL databases are built specifically to handle joins efficiently and maintain consistency across related data through foreign keys and constraints.
If your data is mostly self-contained, such as a single document representing a user profile that rarely needs to be joined with other tables, a NoSQL document database like MongoDB is often a more natural fit.
Q: Do I need strong consistency, or can I tolerate eventual consistency?
If incorrect or stale data could cause real harm, such as displaying the wrong account balance or charging a customer twice, you need strong consistency. This points toward a relational database with ACID guarantees.
If slightly stale data is harmless, such as a post's like count briefly lagging behind or a follower count temporarily being off by a few, the more relaxed consistency models of NoSQL can offer better performance and scalability—an acceptable trade-off.
Q: What do my read and write patterns look like?
If your system is read-heavy, with the same data repeatedly queried in complex ways, such as when generating financial reports, SQL databases with robust indexing and query optimization often perform very well.
If your system is write-heavy, with large amounts of data continuously inserted, such as tracking millions of location updates from delivery drivers every few seconds, NoSQL databases like Cassandra are purpose-built to absorb this kind of write load and can far outperform traditional relational databases.
Q: How much will my schema change over time?
If you know your data structure clearly in advance and it is unlikely to change significantly, such as account and transaction tables in a banking system, the fixed schema of a SQL database gives you safety and predictability.
If your data structure is still evolving, or different records naturally have different fields, such as a product catalog where some products have five attributes and others have twenty, a NoSQL database with a flexible schema can spare you painful migrations every time the structure needs to change.
Q: How far does this need to scale?
If your system realistically stays within the capacity of a single well-configured server, perhaps with some vertical scaling, SQL remains an excellent and simpler choice.
If you are building a system whose data physically cannot fit on or be processed efficiently by a single machine, such as a social media platform with billions of posts, NoSQL databases are often designed from the outset for horizontal scaling across multiple machines, making them a more natural fit at this scale.
Quick Reference (Scenario vs. Better Choice)
Banking transactions and account balances - SQL E-commerce orders and payments - SQL User profiles with flexible fields - NoSQL Social media posts, likes, and comments - NoSQL Real-time location tracking - NoSQL Complex reports involving multiple joins - SQL Product catalogs with varying attributes - NoSQL Inventory management requiring strict accuracy - SQL Large-scale chat messaging - NoSQL Financial audit logs - SQL
A Common Real-World Pattern: Using Both
It is worth knowing that most large systems do not choose just one. They use SQL and NoSQL side by side, each serving the parts of the system it suits best.
A ride-hailing app is a good example. User accounts, driver verification, and payment records—data where correctness truly matters—are typically stored in a relational database. Meanwhile, real-time driver location updates, which arrive continuously and do not require a strict relational structure, are often handled by a NoSQL store or an in-memory system built specifically for high write throughput. The platform's search functionality might even use a separate, specialized system like Elasticsearch, because neither SQL nor typical NoSQL databases are optimized for fast, flexible text search.
For beginners, the takeaway is that choosing a database is not a one-time decision for your entire system. It is a decision you make separately for each part of the system, based on the specific needs of that part's data.
Scaling Databases
A single database server can handle only so much before it becomes a bottleneck. As the load increases, database scaling techniques tend to follow a natural progression.
Indexing is usually the first and simplest step. Without an index, the database must scan every row to find what you are looking for, which becomes slow once a table contains millions of rows. An index is a separate, sorted structure built on specific columns that allows the database to jump almost directly to matching rows rather than scanning everything. The trade-off is that indexes consume additional storage and slightly slow down writes, because they must also be updated whenever the data changes.
Partitioning means splitting a large table into multiple smaller tables while keeping them on the same database server. If you have a user table with 500 million rows, you might split it into smaller tables based on user ID ranges. This makes each individual table and its indexes smaller and faster to search.
Primary-replica replication, also called leader-follower replication, comes into play when a single server can no longer handle the read traffic. In this setup, one server—the primary—handles all writes. Its data is copied to one or more other servers, called replicas, which handle reads. Because most applications receive far more read requests than write requests, this lets you scale read capacity simply by adding more replica servers.
Multi-primary setups take this a step further by allowing multiple servers to accept writes. This is common in systems that serve users in different regions. For example, one primary server handles writes from users in Asia, while another handles writes from users in Europe, and the two synchronize periodically. The tricky part is resolving conflicts: deciding what to do when the same record is updated differently on both primary servers before they synchronize.
Sharding is the most complex scaling technique and should generally be a last resort. Sharding distributes data across entirely separate database servers, called shards, rather than simply placing it in different tables on the same server. A social media platform with billions of users might shard its user data by user ID, so users with IDs in one range reside entirely on one physical database server, while those with IDs in another range reside on a completely different server. This allows you to scale almost indefinitely because you are no longer limited by the capacity of a single machine. However, operations such as joining data across shards become expensive and complex because the data now lives on physically separate machines.
Real-world example: Instagram famously sharded its PostgreSQL database early on to cope with explosive user growth, distributing user data across multiple database servers based on user ID rather than trying to vertically scale a single large server.
A Deeper Look at Caching
Caching stores frequently requested data somewhere fast to access, typically in memory using tools such as Redis or Memcached, so repeated requests do not have to hit the database every time.
Think of a news website’s homepage. Tens of thousands of people might load it every minute, but its content does not change every second. Rather than querying the database and rebuilding the homepage from scratch for every visitor, you can cache the rendered page and serve that cached version to the next several thousand visitors almost instantly.
Caching happens at several different layers. Client-side caching stores data directly on the user’s device—for example, a browser caches website images so they do not need to be downloaded again on every visit. Server-side caching stores data in a fast, shared layer such as Redis, which all application servers can access. CDN caching, which we will cover next, stores copies of content geographically closer to users.
The hardest part of caching is not storing data but knowing when to update or remove it—a problem known as cache invalidation. If a product’s price changes on an e-commerce website but the old price remains in the cache, users may see outdated information. One common approach is to set a time to live (TTL) for cached data, so it automatically expires and is refreshed after a set period, such as 10 minutes. Another approach is to update the cache as soon as the underlying data changes, keeping the two in sync from the outset.
Real-world example: When you check cricket scores or other live sports scores in an app, millions of people may be reading the same score at once, even though it changes only occasionally. Caching the score in Redis for a few seconds can dramatically reduce database load compared with querying the database on every refresh.
Here is a simplified example showing how a Node.js server checks Redis first before deciding whether to query the database.
const express = require('express');
const redis = require('redis');
const app = express();
const client = redis.createClient();
app.get('/photo/:id', async (req, res) => {
const photoId = req.params.id;
const cacheKey = `photo:${photoId}`;
// Step 1: check the cache first
const cachedPhoto = await client.get(cacheKey);
if (cachedPhoto) {
console.log('Cache hit');
return res.json(JSON.parse(cachedPhoto));
}
// Step 2: cache miss, fetch from database
console.log('Cache miss, querying database');
const photo = await database.getPhotoById(photoId);
// Step 3: store in cache for next time, expire after 1 hour
await client.set(cacheKey, JSON.stringify(photo), { EX: 3600 });
return res.json(photo);
});
Content Delivery Networks (CDNs)
If your main servers are all in one region, users far from that region will notice significantly slower loading times. The reason is simple: their requests physically have farther to travel. A CDN solves this problem by storing copies of static content—images, videos, and stylesheets—on servers distributed around the world, known as edge servers.
When a user requests a piece of content, the request goes to the nearest edge server first, rather than traveling all the way back to your main server. If that edge server already has the content cached, it returns it directly. If not, it fetches the content from the main server, caches it, and then serves it to that user and subsequent users in the region.
This is why video streaming can play smoothly no matter where you are in the world. When you press play, you are almost certainly streaming from a server physically close to you, rather than from the platform’s main data center on another continent.
Real-world example: When you download a large game update from Steam, you are almost certainly downloading it from a CDN edge server near your city, rather than from Steam’s main servers. That is why download speeds are usually fast wherever you live.
Message Queues and Asynchronous Processing
Not every task a system performs needs to be completed immediately while the user waits. Some tasks are better handled in the background, and that is where message queues come in.
Imagine a video-sharing platform. When you upload a video, the platform does not make you wait while it converts the video into multiple resolutions and generates thumbnails. Instead, it confirms the upload almost immediately and places the actual processing work in a queue as a message. A separate group of worker servers picks up tasks from the queue and processes them independently at its own pace.
This decoupling has tangible benefits. If the workers temporarily cannot keep up, tasks wait in the queue rather than crashing the entire system. If a worker crashes while processing a task, that task can be retried rather than lost altogether. Tools such as RabbitMQ and Apache Kafka are commonly used for this purpose. Kafka is particularly good at handling massive volumes of messages, so it is often used for tasks such as tracking real-time location updates from thousands of delivery drivers simultaneously. Writing every update directly to the database in real time would overwhelm it.
Real-world example: When you place an order on Amazon, checkout is confirmed almost instantly. Behind the scenes, however, tasks such as updating inventory counts, notifying the seller, and triggering the shipping workflow are processed asynchronously through queues, so the checkout page does not have to wait for all of them to finish.
The CAP Theorem
Once your data moves from a single server to multiple distributed servers, you encounter an unavoidable trade-off, formally described by the CAP theorem.
CAP stands for Consistency, Availability, and Partition Tolerance. Consistency means every server returns exactly the same, up-to-date data. Availability means the system always responds to requests, even if some servers experience problems. Partition tolerance means the system continues to operate even when some servers temporarily cannot communicate with one another—something that inevitably happens from time to time in any distributed system.
The theorem states that you can fully guarantee at most two of these three properties at the same time. Since network problems are unavoidable in any real-world distributed system, partition tolerance is essentially nonnegotiable. The real decision therefore usually comes down to whether to prioritize consistency or availability when a partition occurs.
Here is a practical example: When you post something on social media, it may take a little while for all your followers around the world to see it, because the update needs time to propagate between servers. The platform chooses availability—remaining responsive—over strict consistency—ensuring everyone immediately sees the very latest data. A slight delay in displaying a post is far better than taking the entire platform down every time two servers briefly lose contact.
As a general rule, systems that handle money or critical transactions, such as banking systems, tend to prioritize consistency. Systems such as social feeds or product catalogs, where slightly stale data does little harm, tend to prioritize availability.
Real-world example: DynamoDB, the database behind Amazon’s shopping cart system, is well known for prioritizing availability over strict consistency. Amazon considers it far better for the cart to remain accessible—even if it occasionally displays slightly stale data—than to become completely unavailable whenever the network hiccups.
Proxies: Forward Proxies and Reverse Proxies
A proxy is a server that sits between a client and another server. There are two types worth understanding.
A forward proxy sits in front of the client and makes requests on its behalf. A VPN is a common real-world example: the destination server sees only the VPN’s identity, not the actual user’s. Forward proxies are used to access geographically restricted content or to let organizations filter which websites employees can visit.
A reverse proxy sits in front of a server or group of servers and handles incoming requests on their behalf. The client communicates only with the reverse proxy and never directly interacts with the actual backend servers. A load balancer is a common example of a reverse proxy. Reverse proxies are also used for SSL termination—taking on the work of encrypting and decrypting secure traffic for the actual application servers—and to keep backend servers from being exposed directly to the internet.
Real-world example: Cloudflare commonly operates as a reverse proxy in front of millions of websites, absorbing traffic, filtering malicious requests, and forwarding legitimate requests to the actual origin servers, while keeping those servers’ real IP addresses hidden from the public internet.
How to Approach an HLD Problem, Step by Step
Knowing these building blocks is only half the battle. The other half is knowing where to start when someone gives you a system design problem, whether in an interview or during your own practice. The following framework works well for beginners.
Step 1: Clarify the Requirements
Before drawing a single box, make sure you understand what the system actually needs to do. If someone asks you to design something like a photo-sharing app, don’t make assumptions. Ask what the core features are, how many users the system needs to support, whether it needs to handle both uploads and browsing, and what matters most—speed, consistency, or cost.
Skipping this step is one of the most common mistakes beginners make. Jumping straight into a solution before understanding the problem usually leads to a design that solves the wrong problem.
Step 2: Estimate the Scale
Once you understand the requirements, think about the rough numbers. How many users will use the system? Roughly how many requests per second does that translate to? How much data will accumulate over time?
You don’t need exact figures. The goal is to get a rough sense of the scale you’re designing for, because a system built for a thousand users looks very different from one built for a hundred million.
Step 3: Identify the Core Components
Now start identifying the main components your system will need. Typical considerations include where to store data, whether you need a cache, whether you need a queue for background tasks, and whether you need a CDN to deliver media.
At this stage, resist the urge to overengineer. Beginners often want to include every advanced tool they’ve heard of, even when the problem doesn’t call for it. Start simple, and add complexity only when there’s a clear reason to do so.
Step 4: Map Out the Data Flow
Walk through what happens, step by step, when a user interacts with the system. If a user uploads a photo, trace its path: the request reaches the load balancer, gets routed to a server, and the server stores the image, writes its metadata to a database, and perhaps triggers a background task to generate a thumbnail.
Drawing out the flow, even roughly, can help you spot gaps in the design before they turn into real problems.
Step 5: Identify Bottlenecks and Points of Failure
Ask yourself: What happens if a server goes down? What if traffic suddenly spikes? As usage grows, which part of the system is most likely to become a bottleneck? This is where concepts such as caching, horizontal scaling, and redundancy come into play.
Thinking about failures early, rather than assuming everything will always run perfectly, is a habit that distinguishes strong system design thinking from weak system design thinking.
Step 6: Discuss the Trade-offs
Almost every decision in system design involves a trade-off. Choosing a relational database over a NoSQL database may offer stronger consistency but lower write performance at scale. Caching data aggressively may improve speed, but it also introduces the risk of serving slightly outdated information.
Being able to explain why you made a particular choice, and what you gave up in return, matters more than choosing a theoretically perfect answer. In system design, there is often no single correct answer—only reasonable solutions grounded in clear thinking.
LLD Fundamentals, With Java Examples (Low-Level Design Basics with Java Examples)
1. Object-Oriented Programming: The Foundation of LLD
Almost all low-level design (LLD) is built on object-oriented programming, so before diving into design patterns, you need a solid grasp of its four core principles.
Encapsulation
Encapsulation means bundling data with the methods that operate on it, while keeping the internal state private and providing controlled access only through methods.
public class BankAccount {
private double balance; // private, hidden from outside
public BankAccount(double initialBalance) {
this.balance = initialBalance;
}
public void deposit(double amount) {
if (amount > 0) {
balance += amount;
}
}
public void withdraw(double amount) {
if (amount > 0 && amount <= balance) {
balance -= amount;
}
}
public double getBalance() {
return balance;
}
}
External classes cannot change the balance directly. Every change goes through deposit or withdraw, which enforce rules such as preventing a negative balance.
Abstraction
Abstraction means exposing a simple interface while hiding the complexity behind it.
public abstract class PaymentProcessor {
public abstract void processPayment(double amount);
}
public class CreditCardProcessor extends PaymentProcessor {
@Override
public void processPayment(double amount) {
// complex logic: contacting bank, verifying card, fraud check
System.out.println("Processing credit card payment of " + amount);
}
}
A class that uses PaymentProcessor only needs to call processPayment(amount). It knows nothing about the bank verification or fraud checks happening underneath.
Inheritance
Inheritance allows a class to reuse the properties and behavior of its parent class.
public class Vehicle {
protected String licensePlate;
protected int capacity;
public Vehicle(String licensePlate, int capacity) {
this.licensePlate = licensePlate;
this.capacity = capacity;
}
public void displayInfo() {
System.out.println("Vehicle: " + licensePlate + ", Capacity: " + capacity);
}
}
public class Car extends Vehicle {
public Car(String licensePlate) {
super(licensePlate, 4);
}
}
public class Bike extends Vehicle {
public Bike(String licensePlate) {
super(licensePlate, 1);
}
}
Both Car and Bike reuse licensePlate, capacity, and displayInfo from Vehicle without duplicating the code.
Polymorphism
Polymorphism means that the same method call can behave differently depending on the object.
public class Car extends Vehicle {
public Car(String licensePlate) {
super(licensePlate, 4);
}
public double calculateFare(double distance, double time) {
return distance * 10 + time * 2;
}
}
public class Bike extends Vehicle {
public Bike(String licensePlate) {
super(licensePlate, 1);
}
public double calculateFare(double distance, double time) {
return distance * 5;
}
}
Vehicle v1 = new Car("KA01AB1234");
Vehicle v2 = new Bike("KA01XY5678");
Calling calculateFare on each object runs different logic depending on whether it is actually a Car or a Bike, even though the calling code does not need to know which one it is dealing with.
2. SOLID Principles, with Code
Single Responsibility Principle
A class should have only one reason to change, meaning it should do just one thing and do it well. Imagine a class called Invoice that both calculates the total price and handles printing the invoice as a PDF. If the printing logic needs to change, you are modifying a class that is also responsible for price calculations, increasing the risk of accidentally breaking unrelated functionality. The solution is to split it into two classes: one for invoice calculations and another dedicated to printing.
Bad: one class handles two jobs:
public class Invoice {
public double calculateTotal(List<Item> items) {
double total = 0;
for (Item item : items) {
total += item.getPrice();
}
return total;
}
public void printInvoice(List<Item> items) {
// logic to print invoice as PDF
System.out.println("Printing invoice...");
}
}
Fixed: split the responsibilities into two classes:
public class InvoiceCalculator {
public double calculateTotal(List<Item> items) {
double total = 0;
for (Item item : items) {
total += item.getPrice();
}
return total;
}
}
public class InvoicePrinter {
public void printInvoice(List<Item> items) {
System.out.println("Printing invoice...");
}
}
Open/Closed Principle
A class should be open for extension but closed for modification. This means you should be able to add new functionality without changing existing code that has already been tested. Returning to the vehicle example, if you want to add a new vehicle type such as Truck, you should be able to create a new Truck class that fits into the existing structure, rather than opening up the existing Vehicle class and modifying its core logic every time you add a new type.
Bad: modifying existing code to add a new type:
public class DiscountCalculator {
public double calculateDiscount(String customerType, double amount) {
if (customerType.equals("regular")) {
return amount * 0.05;
} else if (customerType.equals("premium")) {
return amount * 0.10;
}
return 0;
}
}
Fix: allow extensions without modifying existing code:
public interface DiscountStrategy {
double calculate(double amount);
}
public class RegularCustomerDiscount implements DiscountStrategy {
public double calculate(double amount) {
return amount * 0.05;
}
}
public class PremiumCustomerDiscount implements DiscountStrategy {
public double calculate(double amount) {
return amount * 0.10;
}
}
Now, adding a new customer type means adding a new class rather than editing the existing logic.
Liskov Substitution Principle
Objects of a subclass should be able to replace objects of their parent class without breaking the program. Suppose you have a base class called Bird with a method called fly, and you create a subclass called Penguin that extends Bird. This poses a problem because penguins cannot actually fly. If your code assumes that any Bird object can fly, substituting a Penguin object breaks that assumption. This principle reminds you to design class hierarchies carefully, based on genuinely shared behavior rather than superficial similarities.
Bad: violates the substitution principle:
public class Bird {
public void fly() {
System.out.println("Flying");
}
}
public class Penguin extends Bird {
@Override
public void fly() {
throw new UnsupportedOperationException("Penguins can't fly");
}
}
Fix: restructure the hierarchy to reflect actual behavior:
public abstract class Bird {
public abstract void move();
}
public class Sparrow extends Bird {
public void move() {
System.out.println("Flying");
}
}
public class Penguin extends Bird {
public void move() {
System.out.println("Swimming");
}
}
Interface Segregation Principle
A class should not be forced to implement methods it does not use. Imagine an interface called Worker with work and eat methods. Now imagine creating a Robot class that implements Worker. A robot can work, but it does not eat. Yet it is forced to implement an eat method that serves no real purpose. The solution is to split the interface into smaller, more specific interfaces, such as Workable and Eatable, so that classes only need to implement methods that actually apply to them.
Bad: forces a class to implement methods it does not need:
public interface Worker {
void work();
void eat();
}
public class RobotWorker implements Worker {
public void work() {
System.out.println("Robot working");
}
public void eat() {
// makes no sense for a robot
throw new UnsupportedOperationException();
}
}
The fix: split it into smaller interfaces:
public interface Workable {
void work();
}
public interface Eatable {
void eat();
}
public class RobotWorker implements Workable {
public void work() {
System.out.println("Robot working");
}
}
public class HumanWorker implements Workable, Eatable {
public void work() {
System.out.println("Human working");
}
public void eat() {
System.out.println("Human eating lunch");
}
}
Dependency Inversion Principle
High-level modules should not depend directly on low-level modules. Both should depend on abstractions. Imagine a class called NotificationService that directly creates and depends on an EmailSender class. If you later want to send notifications via SMS, you would have to go back and modify NotificationService itself. Instead, if NotificationService depends on a general interface called MessageSender, and both EmailSender and a new SmsSender implement that interface, you can switch notification methods without changing NotificationService.
Bad approach: tightly coupled to a specific implementation:
public class EmailSender {
public void send(String message) {
System.out.println("Sending email: " + message);
}
}
public class NotificationService {
private EmailSender emailSender = new EmailSender();
public void notifyUser(String message) {
emailSender.send(message);
}
}
The fix: depend on an abstraction instead:
public interface MessageSender {
void send(String message);
}
public class EmailSender implements MessageSender {
public void send(String message) {
System.out.println("Sending email: " + message);
}
}
public class SmsSender implements MessageSender {
public void send(String message) {
System.out.println("Sending SMS: " + message);
}
}
public class NotificationService {
private MessageSender messageSender;
public NotificationService(MessageSender messageSender) {
this.messageSender = messageSender;
}
public void notifyUser(String message) {
messageSender.send(message);
}
}
Now NotificationService can work with any MessageSender. Switching from email to SMS requires no changes to NotificationService itself.
Together, these five principles form the philosophy behind almost all design patterns. Most well-structured codebases you encounter also follow them closely, even if the original developers never explicitly labeled them as SOLID.
- Design Patterns, with Code Examples
Design patterns are proven, reusable solutions to recurring problems in software design. They are not rules you must blindly follow, but rather a shared language among developers—a way to solve common problems using approaches that have been tested and refined over time.
When you hear a developer say, “Just use a factory here,” they are not inventing anything new. They are referring to a widely recognized and well-understood solution to a particular type of problem. This saves everyone time and keeps the codebase aligned with patterns other developers already know.
For beginners, the best design patterns to start with are Singleton, Factory, Observer, Strategy, Decorator, and Builder. Let’s explore them one by one through concrete examples.
Singleton Pattern
This pattern ensures that only one instance of a class exists throughout the application and provides a global access point to it. A common example is a Logger class. You would not want multiple independent logger instances scattered throughout your application, each potentially logging in a slightly different way or writing to a different location. A shared Logger instance ensures that every part of the application logs consistently to the same location.
public class Logger {
private static Logger instance;
private Logger() {}
public static Logger getInstance() {
if (instance == null) {
instance = new Logger();
}
return instance;
}
public void log(String message) {
System.out.println("LOG: " + message);
}
}
Logger.getInstance().log("Application started");
Every call to getInstance() returns the same shared object.
Factory Pattern
Use this pattern when you need to create objects but do not want the calling code to know which specific class is being instantiated. Imagine a system that can send notifications via email, SMS, or push notifications. Rather than having the main code decide which concrete class to create each time, you can let a NotificationFactory accept a type (such as “email” or “sms”) and return the appropriate object. This means that if you add a new notification type later, you only need to update the factory, rather than every place in the code that creates notifications.
public interface Notification {
void notifyUser();
}
public class EmailNotification implements Notification {
public void notifyUser() {
System.out.println("Sending Email Notification");
}
}
public class SmsNotification implements Notification {
public void notifyUser() {
System.out.println("Sending SMS Notification");
}
}
public class NotificationFactory {
public static Notification createNotification(String type) {
if (type.equalsIgnoreCase("email")) {
return new EmailNotification();
} else if (type.equalsIgnoreCase("sms")) {
return new SmsNotification();
}
throw new IllegalArgumentException("Unknown type: " + type);
}
}
Notification notification = NotificationFactory.createNotification("email");
notification.notifyUser();
The calling code never directly instantiates EmailNotification or SmsNotification; it simply asks the factory for what it needs.
Observer Pattern
This pattern defines a one-to-many relationship: when an object's state changes, all its dependents are automatically notified. YouTube subscriptions are a great real-world example. When a channel you subscribe to uploads a new video, you receive a notification without having to keep checking yourself. You subscribe once, and the system automatically notifies you whenever there is an update. In code, the channel is the “subject,” and each subscriber is an “observer” waiting to be notified of changes.
public interface Observer {
void update(String videoTitle);
}
public class Subscriber implements Observer {
private String name;
public Subscriber(String name) {
this.name = name;
}
public void update(String videoTitle) {
System.out.println(name + " notified: New video - " + videoTitle);
}
}
public class Channel {
private List<Observer> subscribers = new ArrayList<>();
public void subscribe(Observer observer) {
subscribers.add(observer);
}
public void uploadVideo(String title) {
for (Observer observer : subscribers) {
observer.update(title);
}
}
}
Channel channel = new Channel();
channel.subscribe(new Subscriber("Harry"));
channel.subscribe(new Subscriber("Alex"));
channel.uploadVideo("System Design Basics");
When the channel uploads a new video, every subscribed observer is automatically notified.
Strategy Pattern
This pattern lets you define a family of algorithms, encapsulate each one in a separate class, and make them interchangeable at runtime. Think of a shopping app that supports multiple payment methods (credit card, UPI, wallet). Rather than writing a long chain of if-else statements to decide which payment logic to execute, you can make each payment method a separate strategy class that implements a common interface. The checkout process simply calls the selected strategy's payment method without needing to know how each strategy works internally.
public interface PaymentStrategy {
void pay(double amount);
}
public class CreditCardPayment implements PaymentStrategy {
public void pay(double amount) {
System.out.println("Paid " + amount + " using Credit Card");
}
}
public class UpiPayment implements PaymentStrategy {
public void pay(double amount) {
System.out.println("Paid " + amount + " using UPI");
}
}
public class Checkout {
private PaymentStrategy paymentStrategy;
public Checkout(PaymentStrategy paymentStrategy) {
this.paymentStrategy = paymentStrategy;
}
public void completePayment(double amount) {
paymentStrategy.pay(amount);
}
}
Checkout checkout = new Checkout(new UpiPayment());
checkout.completePayment(500);
To switch payment methods, simply pass in a different strategy—no if-else chain needed.
Decorator Pattern
This pattern lets you dynamically add new behavior to an object without changing its original structure. A classic example is a coffee ordering system. You start with a basic Coffee object, then wrap it with decorators such as Milk, Sugar, or WhippedCream. Each decorator adds to the cost and description without modifying the original Coffee class. This is far more flexible than creating a separate class for every possible combination of coffee and add-ons.
public interface Coffee {
double getCost();
String getDescription();
}
public class BasicCoffee implements Coffee {
public double getCost() {
return 50;
}
public String getDescription() {
return "Coffee";
}
}
public abstract class CoffeeDecorator implements Coffee {
protected Coffee decoratedCoffee;
public CoffeeDecorator(Coffee coffee) {
this.decoratedCoffee = coffee;
}
}
public class MilkDecorator extends CoffeeDecorator {
public MilkDecorator(Coffee coffee) {
super(coffee);
}
public double getCost() {
return decoratedCoffee.getCost() + 10;
}
public String getDescription() {
return decoratedCoffee.getDescription() + " with Milk";
}
}
Coffee order = new MilkDecorator(new BasicCoffee());
System.out.println(order.getDescription() + " costs " + order.getCost());
Each decorator wraps the underlying object, adding to its cost and description without changing the original BasicCoffee class.
Builder Pattern
This pattern is useful when an object has many optional parameters. Creating an object through a constructor with a dozen parameters can become confusing and error-prone. Imagine building a custom computer with choices for CPU, RAM, storage, and GPU, many of which are optional. A builder lets you construct the object step by step, setting only the parameters you care about, then calling the build method to get the finished object. This keeps object creation readable and flexible.
public class Computer {
private String cpu;
private int ram;
private int storage;
private String gpu;
private Computer(Builder builder) {
this.cpu = builder.cpu;
this.ram = builder.ram;
this.storage = builder.storage;
this.gpu = builder.gpu;
}
public static class Builder {
private String cpu;
private int ram;
private int storage;
private String gpu;
public Builder setCpu(String cpu) {
this.cpu = cpu;
return this;
}
public Builder setRam(int ram) {
this.ram = ram;
return this;
}
public Builder setStorage(int storage) {
this.storage = storage;
return this;
}
public Builder setGpu(String gpu) {
this.gpu = gpu;
return this;
}
public Computer build() {
return new Computer(this);
}
}
}
Computer myComputer = new Computer.Builder()
.setCpu("Intel i7")
.setRam(16)
.setGpu("RTX 4060")
.build();
You only set the fields you care about, and the final build() call neatly assembles the object—no constructor with a long list of parameters required.
UML and Class Diagrams (Unified Modeling Language and Class Diagrams)
Before writing a single line of code for a low-level design (LLD) problem, experienced engineers sketch out their designs visually. The standard visual language used for this is UML, or Unified Modeling Language. UML is neither code nor a programming language. It is a standardized set of symbols and diagram types that lets you represent a system’s structure and behavior on paper or a whiteboard. Anyone familiar with UML can look at your diagram and immediately understand how the classes are organized without reading a single line of code.
As a beginner, you do not need to master every type of UML diagram. What really matters for LLD is a thorough understanding of class diagrams, because you will use them frequently in both interviews and real-world projects.
Why UML matters, even when it feels like extra work
It is tempting to skip diagrams and jump straight into coding, especially when you already have a rough idea in mind. But once a problem involves more than three or four classes, this almost always backfires. A class diagram forces you to make decisions about structure and relationships before diving into implementation details—when mistakes are cheapest to fix. Spotting a flawed relationship on a whiteboard takes ten seconds. Discovering the same mistake after writing two hundred lines of code could mean rewriting a large chunk of your project.
There is also a communication benefit. In real engineering teams, a class diagram is often the fastest way to get everyone aligned on a design before anyone opens an IDE. It becomes a shared reference point, avoiding the ambiguity of describing class structures purely in words.
The basic components of a class diagram
A class diagram represents each class as a rectangle divided into three vertically stacked compartments.
The top compartment contains the class name.
The middle compartment lists the class’s attributes—its fields or properties—along with their data types.
The bottom compartment lists the class’s methods—its functions—along with their parameters and return types.
Notice the small symbol before each attribute and method. These are visibility markers, and they matter because they tell you how accessible each member is from outside the class.
A minus sign (-) means the member is private and can only be accessed within the class.
A plus sign (+) means the member is public and can be accessed from anywhere.
A hash sign (#) means the member is protected and can be accessed within the class and its subclasses.
A tilde (~) means the member has package or default visibility and can only be accessed within the same package.
Once you are familiar with these symbols, you can look at any class diagram and immediately understand which parts of a class are intended for external use and which should remain hidden. This directly reflects the principle of encapsulation discussed earlier.
Relationships between classes
The real value of a class diagram lies in showing how classes relate to one another, not just what each class contains. There are several distinct types of relationships, and beginners often confuse them, so it is worth understanding each one clearly.
Association
Association is the most general relationship. It indicates that one class uses or connects to another class in some way. It is drawn as a simple straight line between two class boxes. For example, a Teacher class and a Student class might have an association if a Teacher can be linked to a Student, but neither owns or controls the other’s lifecycle. If the Teacher object is destroyed, the Student object continues to exist independently.
Aggregation
Aggregation is a special, weaker form of association that represents a “has-a” relationship: one class contains another, but the contained object can exist independently. It is drawn as a line with a hollow (unfilled) diamond at the containing class’s end. A good example is a Department class containing multiple Professor objects. If the Department is dissolved, the Professor objects do not disappear; they can move to another department. This independence makes it aggregation rather than the next type of relationship.
Composition
Composition is a stronger form of the “has-a” relationship in which the contained object’s lifecycle depends entirely on its container. It is drawn as a line with a solid (filled) diamond at the containing class’s end. A classic example is a House class containing Room objects. A Room has no meaning outside the House it belongs to. If the House object is destroyed, its Room objects are destroyed as well. This distinction between aggregation and composition often confuses beginners, but the test is simple: ask whether the contained object can still exist independently if the container disappears. If it can, the relationship is aggregation; if it cannot, it is composition.
Inheritance (Generalization)
Inheritance represents an “is-a” relationship in which one class is a specialized version of another. It is drawn as a solid line with a hollow triangular arrowhead pointing to the parent class. Returning to the earlier example, if both Car and Bike inherit from Vehicle, you would draw one line from Car to Vehicle and another from Bike to Vehicle, each with a hollow triangle pointing to Vehicle. This indicates that Car and Bike are both specialized types of Vehicle.
Realization
Realization represents the relationship between a class and an interface it implements. It is drawn as a dashed line with a hollow triangular arrowhead pointing to the interface. If a class named EmailSender implements an interface named MessageSender, you would draw a dashed line from EmailSender to MessageSender, with the hollow triangle pointing to MessageSender. The dashed line specifically indicates interface implementation rather than direct inheritance from a concrete class.
Dependency
Dependency is the weakest and most short-lived relationship. It indicates that one class uses another only temporarily, typically as a method parameter, without retaining a long-term reference to it. It is drawn as a dashed line with a simple open arrowhead. For example, if the OrderService class has a method that accepts a Logger object as a parameter and uses it to log messages only during that method call, without storing the Logger permanently as a field, that is a dependency, not an association.
Multiplicity: Describing Quantities
Class diagrams also use numbers or symbols placed near either end of a relationship line to describe how many instances of one class can be related to instances of another. This is called multiplicity.
1 means exactly one instance is involved.
0..1 means zero or one instance, indicating that the relationship is optional.
- or 0..* means zero or more instances.
1..* means at least one instance, and potentially many.
For example, if ParkingLot contains multiple ParkingSpot objects, you would draw an association between them, placing 1 at the ParkingLot end and 1..* at the ParkingSpot end. This indicates that a parking lot can have multiple parking spots, but each parking spot belongs to exactly one parking lot.
A Complete Example
Let’s bring all these concepts together using the parking lot example from earlier. A simplified class diagram can be described as follows.
ParkingLot has a composition relationship with ParkingSpot because a parking spot has no meaning without belonging to a specific parking lot. In this relationship, one ParkingLot corresponds to multiple ParkingSpot objects.
Car, Bike, and Truck all have an inheritance relationship with the base class Vehicle, represented by hollow triangular arrowheads pointing toward Vehicle.
ParkingSpot has an association with Vehicle because a spot can be occupied by a vehicle, but the vehicle can exist independently of any particular spot—for example, while it is still on the road.
Ticket has associations with both Vehicle and ParkingSpot because a ticket references which vehicle is parked in which spot, but owns neither of them.
ParkingLot depends on the PaymentStrategy interface because it temporarily uses the selected payment strategy to calculate fees without permanently retaining a specific implementation.
Sketching this structure visually before writing any Java code makes the overall design immediately clear and makes mistakes much easier to spot. For example, you might realize that Ticket is missing a reference to ParkingSpot simply by looking at the boxes and arrows, rather than discovering it halfway through writing the code.
Common Mistakes UML Beginners Make
A few mistakes tend to recur when beginners start using class diagrams.
Confusing aggregation with composition is very common. When in doubt, always return to the independent-existence test described earlier.
Overusing inheritance is another common mistake. Beginners sometimes use inheritance whenever two classes share a few similar fields, even when there is no genuine “is-a” relationship. If the relationship does not make logical sense, as in the earlier Penguin and Bird example, association or composition is usually a better choice.
Trying to diagram everything in the system at once is another common pitfall. In practice, especially during interviews, you only need to draw the core classes relevant to the problem at hand, rather than listing every possible class and edge case from the outset.
Tools for Drawing UML Diagrams
You do not need specialized software to benefit from thinking in UML. A whiteboard, a sheet of paper, or a simple drawing tool is more than enough, especially in an interview setting, where you are expected to sketch quickly rather than produce polished diagrams. For personal practice or documentation, tools such as draw.io and Lucidchart, or even text-based tools such as PlantUML, let you create clearer diagrams that are easy to update as your design evolves.
The specific tool matters far less than the habit itself. What distinguishes strong low-level design (LLD) thinking from weak LLD thinking is not whether you have memorized every UML symbol. It is whether you consistently pause to map out relationships before writing code and use that sketch to catch structural problems while they are still easy to fix.
How to Approach an LLD Problem, Step by Step
Understanding OOP principles, SOLID, and design patterns is the theoretical part. For most beginners, the harder part is applying that theory to a new problem, such as "design a parking lot" or "design a vending machine." Here is a proven framework, complete with a worked example to show you how each step plays out in practice.
We will use a common beginner LLD problem—designing a parking lot system—as our running example.
Step 1: Clarify the Requirements
As with HLD, LLD starts with understanding the problem, not jumping straight into class design. For a parking lot system, you need to clarify questions such as: Does the lot have different spot sizes for motorcycles, cars, and trucks? Does the system need to calculate parking fees? Does it need to track the number of available spots? Does it need to support multiple entry and exit points?
Skipping this step often leads to designing classes for a problem other than the one actually being asked. A parking lot with a flat-rate fee structure looks very different in code from one that charges based on parking duration and vehicle type.
Step 2: Identify the Core Objects, or Entities
Once the requirements are clear, start listing the real-world things involved in the problem. For a parking lot, these will likely include Vehicle, ParkingSpot, ParkingLot, Ticket, and Payment.
A useful technique here is to think of these as the nouns in the problem description. Whenever you can point to a distinct "thing" in the system that has its own data and behavior, it is likely a candidate for a class.
Step 3: Define Relationships Between Objects
Now work out how these objects relate to one another. Does a parking lot contain multiple parking spot objects? Is a vehicle assigned to one parking spot at a time? Is a ticket issued when a vehicle enters and closed out when it leaves?
This is where you make decisions about composition and inheritance. For example, you might decide that cars, bicycles, and trucks all inherit from a base Vehicle class because they share common attributes, such as a license plate number and vehicle type, but differ in specific behavior, such as the size of the parking spots they can occupy.
Step 4: Identify Behaviors and Assign Responsibilities
Define what each class actually needs to do. The ParkingLot class might need a method to find an available spot and assign it to an incoming vehicle. A ParkingSpot might need a method to mark itself as occupied or available. A Ticket might need a method to calculate the final fee based on how long the vehicle has been parked.
This is also where the Single Responsibility Principle becomes important. It is tempting to cram all the logic into one enormous ParkingLot class, but a well-designed system distributes responsibilities across classes so that each has a clear, focused purpose.
Step 5: Apply Relevant Design Patterns
Once the basic structure is in place, look for places where design patterns fit naturally. In the parking lot example, if there are multiple ways to calculate fees, such as hourly rates versus flat rates, the Strategy pattern is a good fit. It lets you swap out the fee calculation logic without modifying the core ParkingLot class.
If the system needs just one shared instance to manage the state of the entire parking lot, the Singleton pattern might be appropriate for the ParkingLot class itself.
Do not force patterns into places where they do not fit naturally. A common beginner mistake is trying to use as many patterns as possible to impress others, when a simpler solution without them would actually be clearer. Patterns should solve real problems in your design, not be added for their own sake.
Step 6: Sketch It Out Before Coding
Before writing any actual code, draw a rough class diagram. List each class, its main attributes, and its key methods. This does not have to be a formal UML diagram; even a simple sketch of boxes and arrows on paper will do.
This step helps catch structural problems early. It is much easier to notice that the Ticket class lacks a reference to its associated vehicle when looking at a quick sketch than after writing fifty lines of code around a flawed structure.
Step 7: Write Clean, Incremental Code
Finally, turn your design into code, one class at a time. Start with the simplest, most foundational classes, such as Vehicle, then move on to classes that depend on them, such as ParkingSpot, and finally ParkingLot.
As you write, keep checking your code against the SOLID principles. Ask yourself whether a class has too many responsibilities, whether you are hardcoding something that should remain flexible, and whether adding a new feature later—such as a new vehicle type or pricing model—will require rewriting existing code or simply adding new code alongside it.
Step 8: Handle Edge Cases
Once the core design works, think through the edge cases. What happens if the parking lot is completely full and a new vehicle arrives? What if a ticket is lost? What if two vehicles are assigned to the same spot because of a timing issue?
Even briefly considering these scenarios demonstrates maturity in your design thinking, going beyond simply making the happy path work.
A Beginner's Practice Roadmap (A Roadmap for Beginners)
Understanding the concepts is one thing. Knowing what order to learn them in, and how to practice them, is what turns theory into usable skills. Here is a roadmap that avoids the common trap of trying to learn everything at once.
Stage 1: Build the Vocabulary First (Start with the Vocabulary)
Before attempting any design problems, spend some time simply understanding the building blocks: servers, load balancers, databases, caches, CDNs, and message queues. Do not design anything yet. Just make sure that when someone says "we cache it at the edge" or "writes go to the primary node," you know exactly what they mean without having to stop and think.
A good way to test yourself is to explain each concept aloud in plain language, as if you were teaching a friend who knows nothing about it. If you struggle to explain something simply, that is a sign you have memorized the terminology without truly understanding it.
Stage 2: Study Simple, Well-Known Systems (Explore Simple, Familiar Systems)
Once you are comfortable with the vocabulary, start reading about how real systems are designed at a high level. Look at simplified breakdowns of how URL shorteners, rate limiters, and basic chat applications work. These are deliberately smaller in scope than designing all of Instagram, which makes them better starting points.
At this stage, you are not designing anything yourself yet; you are recognizing patterns. You are noticing how the same building blocks—caching, load balancing, and queues—appear repeatedly in different combinations depending on the problem.
Stage 3: Attempt Your Own Designs, Badly at First (Try Designing Systems Yourself, Even If Your First Attempts Are Rough)
Now start trying to design simple systems yourself before looking at the solutions. Choose something like a URL shortener or a basic notification system, and work through the framework: clarify the requirements, estimate the scale, define the components, and design the data flow. Only then check how others have approached the problem.
Your first few attempts will probably be rough, and that is expected. The value is not in getting it right immediately, but in forcing yourself to make decisions and justify them—which is exactly what happens in real interviews and on the job.
Stage 4: Work on LLD in Parallel
Do not wait until you feel proficient in HLD before starting LLD. Begin practicing LLD problems alongside HLD, because the two skills reinforce each other. Start with classic beginner-level LLD problems, such as a parking lot system, a vending machine, or a library management system, and actually write the code rather than just drawing diagrams.
Focus on applying SOLID principles, and choose design patterns only when the design genuinely calls for them, rather than just to tick a box. Writing code, even if it is messy at first, builds intuition in a way that simply reading descriptions of patterns cannot.
Stage 5: Dive Deeper into Specific Systems
Once you feel confident in the fundamentals of both areas, move on to more complex, well-known systems. Try designing something like Twitter, Netflix, or a ride-sharing app. These problems force you to combine multiple concepts at once—database sharding, caching, and message queues—and this is where genuine systems design thinking starts to take shape.
Stage 6: Practice Explaining Your Designs, Not Just Building Them
A design that exists only in your head is incomplete. Practice talking through your designs aloud, including the trade-offs you made and why. If you chose NoSQL over SQL for a particular component, be ready to explain exactly why, and what you gave up by making that choice. This matters just as much in interviews as it does in real engineering discussions with your team, where you will regularly need to justify your decisions to others.
A Note on Pacing
Do not try to rush through these stages in a week. System design is a skill built through repeated exposure over time, not something you can master in a weekend of reading. Revisiting the same concepts a few weeks later with more context often teaches you more than a single careful reading the first time around.
Ending Notes (Closing Thoughts)
When you are just starting out, system design can feel like a vast, intimidating field, largely because most resources throw you straight into the deep end without first helping you build a foundation. Hopefully, this guide has done the opposite.
You now understand the difference between HLD and LLD, and why both matter. On the HLD side, you have a solid grasp of the building blocks—servers, load balancers, databases, caches, CDNs, message queues, and scalability—along with the trade-offs that come with them. On the LLD side, you understand object-oriented principles, SOLID principles, and the common design patterns that keep code clean and maintainable as it grows.
None of this will make you a system design expert overnight, and that was never the goal. What it gives you is a map: a clear sense of where to start, what to learn next, and how the pieces fit together. From here, the only way forward is practice. Pick a simple system, make a rough attempt at designing it, learn from where it breaks down, and try again. That repeated cycle will do far more to build this skill over time than reading any single article.
If you found this article useful, the best next step is to stop reading and start designing something, even something small. That is where the real learning begins.
That's all, folks. Cheers!!