Menu

Earn Premium with Referrals

Invite your friends and earn Premium rewards through our referral program.

See how it works and start inviting friends.

HLD vs LLD
LLD

HLD vs LLD

Understand the differences between High-Level Design and Low-Level Design and when each is used.

Why Two Layers Exist

One design layer cannot serve both questions a system raises: will this survive ten million users? and can a developer add a feature without fear? The first needs coarse boxes and resource math; the second needs classes and contracts. Mixing altitudes produces documents nobody can act on — architects debating method signatures while capacity questions go unanswered.

Zoom Levels

┌─────────────────────────────────────────────────────────┐
│ HLD view (10,000 ft)                                    │
│   ┌───────────┐   ┌────────────┐   ┌───────────────┐    │
│   │ Order Svc │──►│ Payment Svc│──►│ Inventory Svc │    │
│   └───────────┘   └─────┬──────┘   └───────────────┘    │
│        │                │                                │
│        ▼ LLD zoom on ONE box                             │
│   ┌───────────────────────────────────────────┐         │
│   │ interface PaymentProcessor                │         │
│   │ class CardProcessor  implements ..        │         │
│   │ class UpiProcessor   implements ..        │         │
│   │ enum PaymentStatus { INITIATED..CAPTURED }│         │
│   └───────────────────────────────────────────┘         │
└─────────────────────────────────────────────────────────┘

The outer frame is what HLD reviewers reason about: three services and their calls. The inset shows what LLD adds for exactly one of those boxes — types, hierarchies, states. Each service in the outer diagram gets its own inset; that multiplication is why HLD fits on one page and LLD fills dozens.

Dimension-by-Dimension

DimensionHLDLLD
Unit of designService / componentClass / interface / function
Core questionScale, failure survivalInternal structure
Key risksLatency, availability, costCoupling, invariants, thread-safety
Artifact size10–15 pages30–100 pages per module or full UML set
Review audienceStaff/principal engineers, architectsSenior engineer of owning team
Time horizonStable years; changes are eventsRefactored continuously
Failure it preventsSystem-wide outageUnmaintainable codebase

The Decision-Type Split

  • HLD decisions are expensive to reverse: database choice, sync-vs-async boundaries, consistency model — reversal means data migration.
  • LLD decisions are cheap to reverse: rename a class, extract an interface, rewire composition — reversal is a refactor commit.
  • Consequence: review effort belongs where reversal cost lives.

Boundary Blur (Real World)

  • Monolith teams blur the labels; decision granularity is the real boundary.
  • A shared library sits between both altitudes.
  • Anti-pattern: an HLD with arrows between services but no owner named for state — that missing detail is precisely what each service’s LLD must answer.

Interview Mapping

  • System Design round ≈ HLD: estimation, bottlenecks, trade-off narration.
  • Machine Coding / LLD round ≈ LLD: working code, clean structure.
  • Shared vocabulary only — preparing DSA + HLD while skipping machine-coding practice fails consistently at the LLD round.

Why the Artifacts Differ

Each deliverable records a decision being made at that altitude. HLD artifacts capture choices about boundaries and resources; LLD artifacts capture choices about structure and contracts. Producing the wrong set means either deciding structure before boundaries (wasted detail) or shipping code with unresolved boundary questions.

Artifact Trees

        HLD DELIVERABLES                     LLD DELIVERABLES
 ┌─────────────────────────┐         ┌──────────────────────────────┐
 │ Architecture diagram    │         │ UML class diagram            │
 │ Component/data-flow map │         │ Sequence diagrams (2–3 core  │
 │ Capacity estimates      │         │   user journeys)             │
 │ Storage schema (coarse) │         │ Interface contracts (Java)   │
 │ API surface sketch      │         │ DB schema to column level    │
 │ Tech choice + rationale │         │ State machines               │
 │ Failure-mode analysis   │         │ Error model + exceptions     │
 └─────────────────────────┘         │ Concurrency notes            │
                                     └──────────────────────────────┘

Left column answers for reviewers: will this hold at scale, and did we consider failure? Right column answers for implementers: exactly what do I build, and what must stay true?

Same Topic, Two Altitudes

ArtifactHLD versionLLD version
DiagramBoxes = services, arrows = protocolsBoxes = classes, arrows = inheritance/association with multiplicity
Schemaorders table exists, sharded by user_idEvery column, type, index, FK, enum values
APIPOST /payments existsPaymentResult pay(PaymentRequest req) throws InsufficientFundsException
State”Payment has states”Full transition table incl. illegal-transition handling
ErrorsRetries/timeouts at service levelException hierarchy per component

Interview Time Budget (40-min LLD round)

  • 5 min — requirements → drives which deliverables matter.
  • 10 min — class diagram (entities, relationships, multiplicities).
  • 15 min — code for the core slice (interface + two implementations + entities).
  • 5 min — one sequence diagram narrated verbally.
  • 5 min — extensibility follow-up.

Naming a skipped deliverable explicitly (“I’d write sequence diagrams next; showing code first”) reads as prioritization. Silent omission reads as ignorance of it.

Grading Signals

  • Class diagram without multiplicities (1..*, 0..1) — incomplete; expect the “can a user have zero orders?” probe next.
  • Code contradicting the drawn diagram — instant credibility loss.
  • Sequence diagram showing only the happy path — senior candidates show the failure path (payment declined mid-booking).

Common Mistakes

  • Drawing microservice boxes in an LLD round (wrong altitude for a Parking Lot problem).
  • Fifteen entity classes but zero interfaces — no seams, extensibility follow-up collapses.
  • Full DB DDL for an in-memory problem — wasted minutes at the wrong layer.

My Private Notes

Notes are auto-saved locally to this device.