What is LLD and Why it Matters
Understand the core definition of Low Level Design, its place in the development lifecycle, and the critical role it plays in preventing technical debt.
Learning Goals
- Differentiate between High Level Design (HLD) and Low Level Design (LLD).
- Explain the architectural spectrum from requirements to implementation.
- Identify the common risks of skipping the LLD phase.
Introduction to Low Level Design (LLD)
Low Level Design (LLD), often referred to as Object-Oriented Design (OOD) or Component-Level Design, is the process of defining the actual logic and structure of individual components within a software system. While High Level Design (HLD) focuses on the "What" (the macro-architecture, servers, databases, and services), LLD focuses on the "How" (the classes, interfaces, methods, and relationships).
LLD acts as the bridge between abstract system architecture and concrete implementation. It ensures that the code we write is not just functional, but also modular, readable, and—most importantly—maintainable.
The System Design Spectrum
To understand LLD, we must see where it sits in the lifecycle of a software project.
In the HLD phase, you might decide that your system needs a "Notification Service." In the LLD phase, you decide that this service will have an INotificationSender interface, with concrete implementations like EmailSender, SmsSender, and PushNotificationSender, managed by a NotificationFactory.
Why LLD Matters: The Cost of Poor Design
Many developers skip formal LLD and jump straight into coding. This often leads to "Big Ball of Mud" architectures where:
- Rigidity: A single change requires cascading modifications across dozens of files.
- Fragility: Fixing a bug in one place breaks seemingly unrelated functionality elsewhere.
- Immobility: Code is so tightly coupled that parts of it cannot be reused in other projects.
Proper LLD mitigates these risks by enforcing Separation of Concerns and Loose Coupling. By spending time designing your classes and their interactions upfront, you significantly reduce the long-term technical debt of the project.
HLD vs. LLD: Key Differences
Understanding the boundary between these two phases is crucial for any senior engineer or architect.
| Feature | High Level Design (HLD) | Low Level Design (LLD) |
|---|---|---|
| Scope | Entire System / Macro-architecture | Individual Modules / Micro-architecture |
| Focus | Services, Databases, Load Balancers, APIs | Classes, Methods, Data Structures, Patterns |
| Stakeholders | Architects, Product Managers, DevOps | Developers, Technical Leads |
| Visuals | Block Diagrams, Network Topologies | Class Diagrams, Sequence Diagrams, State Charts |
| Example | "We need a Redis cache for session management." | "The SessionManager class will use a Strategy pattern to switch providers." |
The Core Goals of LLD
When you are designing at a low level, you are striving to achieve several key engineering qualities:
- Modularity: Breaking the system into independent, interchangeable parts.
- Abstraction: Hiding complex implementation details behind simple interfaces.
- Extensibility: Making it easy to add new features without modifying existing code (the Open-Closed Principle).
- Testability: Designing components that can be easily unit-tested in isolation.
Recap
- LLD is about the internal structure of modules and the relationships between objects.
- It is the intermediate step between architecture (HLD) and the actual code.
- Good LLD prevents technical debt by making systems less rigid and more reusable.
- The focus is on classes, interfaces, and design patterns.
Knowledge Check
Which of the following is a primary focus of Low Level Design (LLD)?