In software engineering, building a complex system is like constructing a city.
You wouldn't start by laying bricks for a single house without a city plan. You first need to decide where the residential areas, commercial zones, power grids, and roads will go.
This city plan is your High-Level Design (HLD).
Once the city plan is approved, an architect takes a single plot of land in a residential zone and designs the detailed blueprint for a house specifying the number of rooms, the plumbing, the electrical wiring, and the materials to be used.
This detailed house blueprint is your Low-Level Design (LLD).
Both are essential, but they operate at different levels of abstraction and serve different purposes.
In this chapter, we will take a deeper look at their differences.
High-Level Design (HLD) answers the question: “How should the system be structured and how will different modules interact?”
The primary focus of HLD is on the "what," not the "how." It answers questions like:
The output of HLD is a set of architectural diagrams, data flow diagrams, and technology choices that define the system's skeleton.
Example: HLD of a Ride-Hailing App
Passenger Service
, Driver Service
, Matching Service
, Billing Service
.Matching Service
uses a message queue to broadcast ride requests. Passenger
and Driver
services communicate via WebSockets for real-time location updates.Low-Level Design zooms in on a single component or module defined in the HLD. It's where the architectural abstractions are translated into concrete, implementable logic. LLD is the detailed blueprint that developers use to write the actual code.
The focus of LLD is on the "how." For a single module, it answers questions like:
Example: LLD of the Billing Service
from the Ride-Hailing App
Ride
, Invoice
, PaymentStrategy
, CreditCardPayment
, WalletPayment
.IPaymentStrategy
with a method processPayment(amount)
. CreditCardPayment
and WalletPayment
would implement this interface.Invoice
class "has-a" Ride
object (Composition).