System Design Academy

Saving…

Lesson 1 of 10 in Module 10 of 45 lessons complete

What Is Low-Level Design?

Module 1, lesson 1Concept12 min

Definition

Low-level design

In plain English
Low-level design is deciding how the code inside one component is organised into types, functions and their relationships.
Think of it like
If high-level design is a house's floor plan, low-level design is the wiring and plumbing inside each room.

Machine-coding round

In plain English
A machine-coding round is an interview where you build a small, working, well-structured program in about 90 minutes.
Think of it like
It is like a cooking contest where the dish must taste good and the kitchen must stay tidy.

Why it exists

You add late fees to a tool-loan service. HandleLoan already checks members, calculates prices, saves records and sends email. One pricing edit now risks breaking four separate jobs.

A condensed 40-line HandleLoan: storage is in memory and email is printed for demonstration.
Go
package main

import "fmt"

func HandleLoan(memberID, itemID string, days int, loans map[string]int) error {
	if memberID == "" || itemID == "" || days < 1 || days > 30 || loans == nil {
		return fmt.Errorf("invalid member, item, duration or storage")
	}
	price := days * 2
	loans[memberID+":"+itemID] = price
	fmt.Printf("Email to %s: borrowed %s for %d credits\n", memberID, itemID, price)
	return nil
}
func main() {
	loans := make(map[string]int)
	fmt.Println(HandleLoan("M7", "drill", 3, loans))
}
  • A pricing change forces you to reread storage and email code.
  • Testing member checks means running unrelated work too.
  • An email failure hides whether the loan was saved.
  • Separate focused operations so you can read, test and extend each rule.

How it works

  1. Read requirements

    Write down what the program must do and the rules it must preserve.

  2. Underline nouns

    Start with types for Member, Item and Loan.

  3. Circle verbs

    Start with methods for Borrow, Return and Reserve.

  4. Decide relationships

    Ask which values contain, refer to or briefly use others.

  5. Define interfaces where things vary

    List the operations a replaceable part must provide.

  6. Code

    Build the smallest design that satisfies the requirements.

  7. Test

    Check normal requests and rejected requests.

  8. Extend

    Add one new requirement and see which code must change.

The order service, shown as an HLD box, connects to three internal parts: Order, Station and Router.

Open one service box to find its code-level types.

The order service, shown as an HLD box, connects to three internal parts: Order, Station and Router.

A named type makes one loan visible in the code.
Go
package main

import "fmt"

type Loan struct{ MemberID, ItemID string }

func main() {
	loan := Loan{MemberID: "M7", ItemID: "drill"}
	fmt.Println(loan.MemberID, loan.ItemID)
}

Examples

Borrowing a shared drill

A member borrows an available item, returns it, or reserves it for later. Each loan records who borrowed which item.

Requirement wordDesign candidate
Member, Item, LoanTypes holding related data
Borrow, Return, ReserveMethods expressing actions
Go fragment: a first draft of the requirement nouns.
Go
type Member struct{ ID string }
type Item struct {
	ID        string
	Available bool
}
type Loan struct{ MemberID, ItemID string }

The insight

Nouns and verbs in requirements are your first draft of a design.

Trade-offs

Pros

  • Readable responsibilities.
  • Focused tests.
  • Easier changes and a stronger interview design.

Cons

  • A slower first version.
  • Too many layers hide the actual task.

Use when

  • Long-lived code.
  • Team projects and machine-coding interviews.

Avoid when

  • Throwaway scripts.
  • One-off experiments with no expected extension.

Quick check

Which is a low-level design decision?
In a library-of-things app, verbs like "borrow" usually become…

Takeaways

  • LLD organises code inside one component.
  • Nouns → types, verbs → methods.
  • Isolate what changes.

Try the quick check above whenever you feel ready.

Previous: City-Wide EV Charging Network — Part B