Part 2 of 7 · 1 min read
Two kinds of design question
One draws the whole city, the other draws one building.
A city planner decides where roads, power and water go. An architect of one building decides the rooms, the doors and which walls carry weight. Both are design, at different sizes.
High-level design (the system design subject on this site) picks servers, databases, caches and queues, and works out how a service handles millions of users. Low-level design picks the classes, the methods and the rules inside one service. The answer is a set of classes with clear jobs, and often some working code.
| High-level design | Low-level design | |
|---|---|---|
| Unit of design | Services, databases, queues | Classes, interfaces, methods |
| Typical question | Design a URL shortener for 100 million users | Design a parking lot |
| Main worry | Load, failure, data size | Clear roles, rules, easy change |
| Output | Boxes and arrows, numbers | Class list, relationships, code |
| Time | 45 to 60 minutes | 45 to 60 minutes |
Low-level design (LLD)
Low-level design is the design of the classes, interfaces and rules inside one program, so that the code is correct, easy to read and easy to change.
Example: for a parking lot, deciding that a Ticket links one Vehicle to one Spot, and that the price rule lives in a separate PricingStrategy class.
Check yourself: 1. Which kind of design asks for requests per second? 2. Which asks you to decide who owns a rule? 3. Name one question that is LLD and one that is HLD.