惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
小众软件
小众软件
MongoDB | Blog
MongoDB | Blog
Jina AI
Jina AI
G
Google Developers Blog
H
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
爱范儿
爱范儿
B
Blog
云风的 BLOG
云风的 BLOG
H
Hackread – Cybersecurity News, Data Breaches, AI and More
GbyAI
GbyAI
博客园 - 叶小钗
aimingoo的专栏
aimingoo的专栏
Blog — PlanetScale
Blog — PlanetScale
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
有赞技术团队
有赞技术团队
博客园_首页
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
LLD Object-Oriented Design: From Requirements to Classes ...
Saras Growth Space · 2026-05-31 · via DEV Community

After learning core object-oriented concepts like encapsulation, inheritance, polymorphism, interfaces, dependency injection, factories, and system layering, one critical skill still remains:

How do we convert a problem statement into actual classes and relationships?

This is the point where most beginners struggle in Low-Level Design interviews.

They understand concepts individually, but fail to transform requirements into a clean object model.


The Real Problem in LLD

Given a question like:

  • Design a parking lot
  • Design Uber
  • Design a food delivery system
  • Design Splitwise

Most people immediately start writing:

  • classes
  • methods
  • APIs

But real design does not begin with code.

It begins with:

  • understanding the domain
  • identifying responsibilities
  • discovering system structure

Step 1: Start with Requirements, Not Classes

Before thinking about objects, first understand:

What does the system need to do?

These are:

  • functional requirements
  • user actions
  • system capabilities

What constraints exist?

These include:

  • scale
  • business rules
  • operational limitations

Without requirement clarity:

  • classes become random
  • abstractions become weak
  • systems become inconsistent

Step 2: Extract Candidate Entities from Requirements

A simple but powerful approach:

Convert problem statements into nouns.


Example: Food Delivery System

From requirements, you may identify:

  • User
  • Restaurant
  • Dish
  • Cart
  • Order
  • Payment
  • DeliveryPartner
  • Vehicle

These become:

candidate entities

Not all will become final classes, but this gives a strong starting point.


Step 3: Filter Entities Using Responsibility Thinking

Not every noun deserves to become a class.

The important question is:

Does this entity own meaningful state or behavior?


Example

Strong entity candidates

  • Order
  • Cart
  • Payment
  • DeliveryPartner

These have:

  • state
  • lifecycle
  • behavior

Possible supporting objects

  • Address
  • Coordinates
  • Money

These may become:

  • value objects
  • supporting models
  • reusable structures

Step 4: Assign Responsibilities

This is one of the most important steps in OOD.

Ask:

What should this entity be responsible for?


Example

Order

Responsible for:

  • maintaining order state
  • tracking lifecycle
  • validating status transitions

PaymentService

Responsible for:

  • processing payments
  • handling payment methods
  • communicating with gateways

DeliveryPartner

Responsible for:

  • accepting deliveries
  • updating delivery progress
  • managing availability state

Step 5: Identify Relationships Between Entities

Now think about interactions.

Questions to ask:

  • Who owns whom?
  • Who depends on whom?
  • Which objects collaborate together?

Example Relationships

  • Cart → belongs to User
  • Order → created from Cart
  • Order → uses PaymentService
  • DeliveryPartner → assigned to Order

At this stage:

focus on relationships, not implementation


Step 6: Discover Behaviors Before Methods

Do not immediately think in code syntax.

Instead ask:

  • What actions happen in the system?
  • Which object should own those actions?

Example

Instead of randomly writing:

process_payment()

Think:

  • who should process payment?
  • PaymentService?
  • Order?
  • external gateway?

This improves responsibility placement.


Step 7: Convert Structure into Classes

Only now should you move toward:

  • classes
  • interfaces
  • services
  • dependencies

At this point, the design becomes:

  • intentional
  • structured
  • easier to evolve

Key Mental Model

Good LLD follows this flow:

Requirements
→ Entities
→ Responsibilities
→ Relationships
→ Behaviors
→ Classes
→ Code

Skipping steps leads to weak design.


Common Mistakes

Beginners often:

  • jump directly into coding
  • force design patterns early
  • create unnecessary classes
  • ignore responsibility ownership

This creates:

  • poor abstractions
  • tight coupling
  • confusing systems

Why This Skill Matters

This requirement-to-design mapping skill is the foundation of:

  • Domain Modeling
  • Real-world system design
  • LLD interviews
  • scalable architecture thinking

Without it:

  • designs remain mechanical
  • systems feel artificial
  • interviews become difficult

Real Insight

The hardest part of object-oriented design is not writing classes — it is discovering the right responsibilities from the problem itself.


One-Line Takeaway

Great LLD starts by understanding the domain deeply enough to discover the right objects, responsibilities, and relationships before writing code.