Skip to content
Veltoryx Technologies
FreeLesson 1.2Beginner9 min readUpdated 31 October 2026

A Step-by-Step Method for Any LLD Problem

Learn a seven-step method you can use on any low-level design problem, from asking the first question to discussing extensions, with a complete library example.

The hardest moment in an LLD interview is the first minute. The interviewer says "design a library system", the board is empty, and your mind goes blank. A method fixes that. If you know what to do first, second and third, you never face an empty board; you simply move to the next step.

This lesson gives you a seven-step method that works for almost every LLD problem. We will first look at the steps, then run through them on one complete example, a small library system, so you see how each step feeds the next.

01The seven steps at a glance

The seven steps of an LLD interview and about how long each one takes in a 45-minute round
Fig. 1 · The seven steps of an LLD interview and about how long each one takes in a 45-minute round

The times are a guide for a 45-minute round. The important point is the shape: a quarter of the time is spent before you draw anything, and only about a third is spent on code. Many people reverse this and run out of time before they have a design worth coding.

Here is the method in one sentence each:

  1. Clarify what the system must do, and what it will not do.
  2. Find the entities: the main things in the problem, which become classes.
  3. Assign responsibilities: decide which class does which job.
  4. Draw the class diagram: the classes and how they connect.
  5. Walk through two or three real scenarios on your diagram to test it.
  6. Write the key code: the important interfaces and methods only.
  7. Discuss extensions and trade-offs: how the design handles change.

Now let us walk through all seven with a real example. The problem: "Design a library system."

02Step 1: Clarify the requirements

Never design from the one-line problem. Ask questions until you can write a short, clear list. Good questions are about who uses the system, what they do, which rules apply and what is out of scope.

For the library, you might ask:

  • Who uses the system? (Members who borrow books. Assume one librarian-run counter for now.)
  • Can the library hold many copies of the same title? (Let us say each book record is one physical copy.)
  • How many books can a member borrow at the same time? (Three.)
  • How long can a book be kept? (14 days.)
  • Can members search for books? (Yes, by title.)
  • What happens when a book is returned late? (Out of scope for now; we will treat it as an extension.)

Write the answers down as a list the interviewer can see:

TypeRequirement
Must doMembers can search books by title
Must doA member can borrow an available book
Must doA member can hold at most 3 books at a time
Must doA loan lasts 14 days
Must doA member can return a borrowed book
Out of scopeFines, reservations, payments, several copies of one title

This table is your contract. If the interviewer later asks for fines, you can say "that was out of scope, but here is how we would add it", which is a strong answer.

03Step 2: Find the entities

An entity is a main "thing" in the problem. The easiest way to find them is to read your requirements and underline the nouns.

A member can search books by title. A member can borrow an available book and holds at most 3 books. A loan lasts 14 days.

The nouns are: member, book, title, loan, library. Not every noun becomes a class. A title is just a piece of text that belongs inside Book, so it is a field, not a class. After this filter we keep: Member, Book and Loan. We will also need one place to coordinate the actions, which we will call LibraryService. The next lesson explains in detail how to decide what becomes a class.

04Step 3: Assign responsibilities

A responsibility is something a class knows or does. Now underline the verbs: search, borrow, return, check availability, hold. Then ask of each one, "which class owns the information needed to do this?"

ClassWhat it knowsWhat it does
BookIts title and ISBN, and whether it is borrowedSays if it is available; marks itself borrowed
MemberIts name and its current loansDecides if it can borrow another book (the limit of 3)
LoanWhich book, which member, due date, return dateSays if it is overdue; closes itself on return
LibraryServiceWhere books and members are storedCoordinates borrow, return and search

Notice the pattern: each rule lives next to the data it needs. The limit of 3 books belongs in Member, because Member knows how many loans it has. This habit keeps classes small and clear.

05Step 4: Draw the class diagram

Now connect the classes. A Member can have many Loan objects. Each Loan refers to exactly one Book. LibraryService uses all three. Here is our first draft:

First draft of the library class diagram with Member, Loan, Book and LibraryService
Fig. 2 · First draft of the library class diagram with Member, Loan, Book and LibraryService

Do not draw every getter and setter. Show the fields and methods that explain the design. Lesson 4 explains the lines and symbols in detail.

06Step 5: Walk through the flows

This step is the one most people skip, and it is where good designs are made. Take two or three real scenarios and "run" them on your diagram, speaking out loud.

Scenario A: borrow an available book. LibraryService finds the member and the book. It asks the member canBorrow(). It asks the book isAvailable(). It creates a Loan, marks the book as borrowed and adds the loan to the member. Every method we need exists on the diagram.

Scenario B: borrow when the member already holds 3 books. canBorrow() returns false, and we refuse. Good.

Scenario C: return a book. LibraryService finds the loan and calls close() on it, which records the return date. Then the book must become available again... but our Book only has markBorrowed(). We found a gap. We need a markReturned() method on Book. Adding it now costs ten seconds; discovering it after you wrote all the code would cost much more.

That is the whole purpose of the walk-through: finding missing methods and classes while the design is still cheap to change.

07Step 6: Write the key code

Now write only the important code: the interfaces and the one or two methods that hold real logic. For the library, the heart is borrowBook. We skip constructors, getters and storage details.

LibraryService.borrowBook: the key logic only
public Loan borrowBook(String memberId, String isbn) {
    Member member = members.find(memberId);
    Book book = books.find(isbn);

    if (!member.canBorrow()) {
        throw new IllegalStateException("Borrow limit reached");
    }
    if (!book.isAvailable()) {
        throw new IllegalStateException("Book is already borrowed");
    }

    Loan loan = new Loan(member, book, LocalDate.now().plusDays(14));
    book.markBorrowed();
    member.addLoan(loan);
    return loan;
}

Read it like a sentence: find the member and the book, refuse if the rules are broken, otherwise create the loan, update the book and the member, and return the loan. Each rule is checked by the class that owns the data (canBorrow on Member, isAvailable on Book). LibraryService only coordinates.

08Step 7: Discuss extensions and trade-offs

Finish by showing that your design can grow. Pick the most likely new requirements and say what changes.

  • "Add late fees." We add a FeePolicy interface and a fee() calculation that uses Loan.isOverdue(). Book, Member and borrowBook do not change.
  • "Add reservations." We add a Reservation class that links a member and a book. Existing classes stay as they are, except LibraryService, which gains a method.
  • "Different limits for students and staff." We move the limit rule behind a BorrowPolicy interface, so each type of member can have its own rule.

You also mention a trade-off: "I kept the limit rule inside Member for simplicity. If rules grow, I would extract a policy class." Naming a trade-off shows maturity.

09Common mistakes

  • Skipping step 1. You design for rules the interviewer never had in mind.
  • Skipping step 5. You find missing methods only after the code is written.
  • A diagram with every getter and setter. It hides the important parts. Show what explains the design.
  • Writing all the code. Time runs out. Write the interface and the core method, and describe the rest.
  • Working silently. The interviewer cannot give you credit for thoughts they cannot hear. Say what you are doing at each step.

10In the interview

  • How much time should I spend on requirements? About five minutes of a 45-minute round. Enough to be sure of the rules, not so long that you have no time to design.
  • What if the interviewer changes a requirement halfway through? Stay calm, because this tests your design. Say which class you would add or change and that the other classes stay as they are.
  • What if I realise my diagram is wrong? Say so openly and fix it. Finding and correcting a mistake early is a good sign, not a bad one.

11Check your understanding

Quiz · 4 questions

0 of 4 answered

  1. 1. In the library example, why do we walk through the return scenario before writing code?

  2. 2. Which of these is a good clarifying question for a vending machine problem?

  3. 3. Where does the rule 'a member can hold at most three books' belong in our design?

  4. 4. Halfway through, the interviewer adds a rule: late returns must pay a fine. What is the best first reaction?