LLD Introduction

What is Low-Level Design?

The art of designing classes, methods, and their interactions to build maintainable, extensible, and clean code that solves real-world problems.

10 min readFoundation

1What is Low-Level Design?

🏠 Simple Analogy
If building a house is like building software:

HLD (High-Level Design) = The architect's blueprint showing how many rooms, where the kitchen goes, overall layout.

LLD (Low-Level Design) = The detailed construction plans showing exactly how to build each wall, where every nail goes, electrical wiring diagrams, and plumbing connections.
Low-Level Design (LLD) is the process of designing the internal structure of a system at the class and method level. It defines how each component works internally, including class hierarchies, method signatures, data structures, and the interactions between objects.

LLD Answers These Questions

❓ What classes do we need?
Identify entities, their attributes, and behaviors
❓ How do classes interact?
Relationships: inheritance, composition, dependency
❓ What design patterns apply?
Singleton, Factory, Strategy, Observer, etc.
❓ How to handle edge cases?
Error handling, validation, state management

2The LLD Process

When you receive an LLD problem, follow this structured approach:

1Gather Requirements
  • What are the core features?
  • Who are the actors (users, admins)?
  • What operations must be supported?
2Identify Entities (Classes)
  • Extract nouns from requirements → These become classes
  • Example: Parking Lot → Car, Spot, Ticket, ParkingLot
3Define Relationships
  • How do entities relate? (has-a, is-a)
  • Example: ParkingLot HAS Floors, Floor HAS Spots
4Design Methods & Behaviors
  • What actions can each entity perform?
  • Example: ParkingLot.parkVehicle(), Spot.isAvailable()
5Apply Design Patterns
  • Use patterns to solve common problems
  • Example: Strategy for pricing, Factory for vehicle creation

LLD Design Flow

Requirements
→
Entities
→
Relationships
→
Methods
→
Patterns
→
Code

3Example: Library Management (Simplified)

Let's walk through a simple LLD example to see the process in action.

📋 Requirements

  • Library has books and members
  • Members can borrow and return books
  • Track which member has which book

📦 Entities Identified

Book - title, author, ISBN, isAvailable
Member - name, memberId, borrowedBooks
Library - books, members

🔗 Relationships

Library HAS many Books (aggregation)
Library HAS many Members (aggregation)
Member HAS borrowed Books (association)

Class Diagram (Simplified)

Book
- title: String
- author: String
- ISBN: String
- isAvailable: boolean
+ getDetails()
+ markBorrowed()
+ markReturned()
Member
- name: String
- memberId: String
- borrowedBooks: List<Book>
+ borrowBook(book)
+ returnBook(book)
+ getBorrowedBooks()
Library
- books: List<Book>
- members: List<Member>
+ addBook(book)
+ registerMember(member)
+ issueBook(memberId, ISBN)
Library System Implementation
// Book.java
public class Book {
    private String title;
    private String author;
    private String ISBN;
    private boolean isAvailable;

    public Book(String title, String author, String ISBN) {
        this.title = title;
        this.author = author;
        this.ISBN = ISBN;
        this.isAvailable = true;
    }

    public boolean isAvailable() { return isAvailable; }
    public void markBorrowed() { this.isAvailable = false; }
    public void markReturned() { this.isAvailable = true; }
    public String getISBN() { return ISBN; }
}

// Member.java
public class Member {
    private String name;
    private String memberId;
    private List<Book> borrowedBooks;

    public Member(String name, String memberId) {
        this.name = name;
        this.memberId = memberId;
        this.borrowedBooks = new ArrayList<>();
    }

    public void borrowBook(Book book) {
        if (book.isAvailable()) {
            book.markBorrowed();
            borrowedBooks.add(book);
        }
    }

    public void returnBook(Book book) {
        book.markReturned();
        borrowedBooks.remove(book);
    }
}

4Skills Required for LLD

🎯OOP Fundamentals
  • • Classes & Objects
  • • Encapsulation
  • • Inheritance
  • • Polymorphism
  • • Abstraction
🧩Design Patterns
  • • Creational (Singleton, Factory)
  • • Structural (Adapter, Facade)
  • • Behavioral (Strategy, Observer)
📐SOLID Principles
  • • Single Responsibility
  • • Open/Closed
  • • Liskov Substitution
  • • Interface Segregation
  • • Dependency Inversion
✨Clean Code
  • • Readable naming
  • • Small functions
  • • DRY (Do Not Repeat Yourself)
  • • KISS (Keep It Simple)

5Common LLD Interview Problems

These are the most frequently asked LLD problems at top tech companies:

Parking LotEasy
• Class hierarchy
• Composition
• Strategy pattern
Elevator SystemMedium
• State pattern
• Observer
• Scheduling algorithms
Chess GameHard
• Inheritance
• Command pattern
• Game state
SplitwiseMedium
• Expense tracking
• Settlement algorithm
• User groups
Vending MachineEasy
• State pattern
• Inventory
• Payment handling
BookMyShowHard
• Seat selection
• Concurrent booking
• Payment
💡 Interview Tip
In LLD interviews, start by clarifying requirements, then draw a class diagram, explain relationships, and finally write code for the core classes. Communication is as important as the solution!

6Key Takeaways

1LLD focuses on the internal structure: classes, methods, and their interactions.
2Follow a systematic process: Requirements → Entities → Relationships → Methods → Patterns.
3Master OOP fundamentals - they are the building blocks of good LLD.
4Learn design patterns - they provide reusable solutions to common problems.
5Apply SOLID principles to write maintainable and extensible code.
6Practice with real problems: Parking Lot, Elevator, Chess, Splitwise.