Course map

Topic 013 / Core

Low-level design (LLD)

Chapter 2.1 · What System Design Is

What and why

An HLD saying "the Order Service talks to the Database" doesn't say which classes exist, what their methods return, or what the schema looks like — and an engineer can't start coding from that alone. Low-level design (LLD) is the detailed design inside one HLD component: its classes or modules, their interfaces, the data schema, and the algorithms for its non-trivial operations — aimed at the engineer about to write the code. Builds on: → 12.

Diagram

Aspect HLD LLD
Audience cross-team, architects the engineer coding this component
Granularity components, data flow classes, methods, schema, algorithms
Cost to change high low to moderate
Example artifact box-and-arrow diagram class list, schema, pseudocode

How it works

  1. Take one HLD component and list the classes or modules it needs.
  2. Define each class's responsibility and public interface.
  3. Design the data schema or structures the component owns.
  4. Work out the algorithm for each non-trivial operation, and its complexity (→ 3).
  5. Check the result against the component's contract with its neighbors from the HLD — if the contract must change, that's a step back to HLD, not a detail to patch around.

Practical example

LLD for the Order Service box from topic 12's diagram: classes OrderController, OrderService, OrderRepository; a schema orders(id, user_id, status, total, created_at); and a method placeOrder(cart) -> Order whose steps validate the cart, charge payment, persist the order, and return it or a typed error.

When to use it

  • Use when: the HLD component boundary is stable and someone is about to write the code.
  • Avoid when: the component is still likely to be redesigned at the HLD level — the detail would be wasted.
  • Failure scenarios: skipping LLD and discovering in code review that two classes silently duplicate the same responsibility.
  • Simpler alternative: a one-class component's LLD is just its method list — don't force a diagram where a list suffices.

Practice

(Mechanism kind; 20 min, no lab services). Take the URL shortener HLD from topic 12's practice and produce the LLD for "resolve a short URL": class names, one schema table, and the lookup algorithm with its complexity. Done when every method signature states what it returns on the not-found case.

Key takeaway

LLD turns one HLD box into code-ready detail: classes, schema, algorithms. Done when you can hand your LLD to another engineer and they don't need to ask a design question before coding. Used next in → 14 (architecture fundamentals), Part 4 (software design patterns).

References

None — this topic makes no external claims.

Source directory

Search the guide