DEV Community

Saras Growth Space
Saras Growth Space

Posted on • Edited on

LLD Domain Modeling: From Requirements to a Domain Model (How Real System Design Actually Happens)

After learning about:

  • Entities
  • Value Objects
  • Aggregates
  • Invariants
  • State transitions
  • Bounded Contexts

a very important question still remains:

“How do we actually apply all of this while designing a real system?”

Because understanding concepts individually is useful.

But real Low-Level Design starts when you can move from:

  • vague requirements to
  • structured domain models.

This is where many beginners struggle.

They know the terminology.

But they don’t yet know:

how experienced engineers think during design.


Real LLD Does NOT Start With Classes

A common beginner flow looks like this:

Requirements
→ Create Classes
→ Add Methods
→ Connect Everything
Enter fullscreen mode Exit fullscreen mode

This usually creates:

  • weak boundaries
  • misplaced responsibilities
  • bloated services
  • inconsistent business logic

Strong LLD follows a very different process.


A Better Design Flow

Real domain modeling usually evolves like this:

Requirements
→ Identify Business Flows
→ Find Entities
→ Separate Value Objects
→ Identify Invariants
→ Define Aggregates
→ Assign Responsibilities
→ Design Services
Enter fullscreen mode Exit fullscreen mode

Notice something important:

classes are not the starting point anymore.

Business behavior is.


Example — Ride Sharing System

Suppose requirements say:

  • user requests ride
  • driver gets assigned
  • ride starts
  • ride completes
  • payment happens

Most beginners immediately start writing classes.

But strong designers first identify:

  • important business objects
  • lifecycle boundaries
  • consistency rules

Step 1 — Identify Core Entities

Possible Entities:

Ride
Driver
User
Payment
Enter fullscreen mode Exit fullscreen mode

Why?

Because:

  • identity matters
  • lifecycle exists
  • business tracking is required

Step 2 — Separate Value Objects

Possible Value Objects:

Location
Fare
Money
TimeRange
Enter fullscreen mode Exit fullscreen mode

Why?

Because:

  • identity does not matter
  • values define them
  • they describe state rather than own lifecycle

Step 3 — Identify Invariants

Now ask:

“What business rules must never break?”

Examples:

  • Ride cannot complete before starting
  • Driver cannot handle multiple active rides
  • Payment cannot process twice

These become consistency rules.


Step 4 — Identify Aggregate Boundaries

Now ask:

“Which objects must remain consistent together?”

Example:

Ride Aggregate
 ├── Ride
 ├── Fare
 ├── PickupLocation
 └── DriverReference
Enter fullscreen mode Exit fullscreen mode

Ride becomes the Aggregate Root because:

  • it controls lifecycle
  • it protects transitions
  • it enforces consistency

Step 5 — Assign Responsibilities Carefully

Now we decide:

Entity Responsibilities

  • protect state
  • enforce business rules
  • validate transitions

Example:

ride.startRide();
ride.completeRide();
Enter fullscreen mode Exit fullscreen mode

Service Responsibilities

  • orchestration
  • external communication
  • workflow coordination

Example:

paymentService.process();
notificationService.send();
Enter fullscreen mode Exit fullscreen mode

This separation prevents bloated systems.


Example — Amazon Cart

Requirements:

  • add items
  • apply coupon
  • calculate total
  • checkout
  • create order

Now think in domain terms.


Entities

Cart
Order
Product
Enter fullscreen mode Exit fullscreen mode

Value Objects

Money
Quantity
Coupon
Enter fullscreen mode Exit fullscreen mode

Invariants

  • quantity cannot be negative
  • cart total must remain valid
  • order total becomes immutable after checkout

Aggregates

Cart Aggregate
 ├── Cart
 ├── CartItems
 └── Pricing Rules
Enter fullscreen mode Exit fullscreen mode

Now the system structure becomes meaningful instead of random.


Good LLD Is About Responsibility Discovery

Strong design is not:

  • memorizing patterns
  • drawing UML diagrams
  • creating large class hierarchies

It is primarily about discovering:

  • ownership
  • boundaries
  • consistency
  • lifecycle control
  • workflow separation

That is what domain modeling helps achieve.


Weak LLD Thinking

“What classes should I create?”


Strong LLD Thinking

“What business behavior must the system protect?”

That shift changes everything.

Because systems are not merely collections of objects.

They are collections of business rules evolving safely over time.


The Biggest Domain Modeling Insight

At a deeper level:

  • Entities model identity
  • Value Objects model meaning
  • Aggregates protect consistency
  • Invariants protect correctness
  • Services orchestrate workflows
  • Bounded Contexts protect separation

And together, these concepts transform:

  • code structures into
  • reliable business systems.

That is the real purpose of Domain Modeling in Low-Level Design.

Top comments (0)