DEV Community

Saras Growth Space
Saras Growth Space

Posted on

LLD Data Structures in Design Context: Why Great LLD Starts With Responsibilities, Not Data Structures

"The biggest mistake in Low-Level Design isn't choosing the wrong data structure. It's assigning the wrong responsibility."

By now, we've explored how different business problems naturally lead to different data structures.

But there's an even more important lesson hiding beneath all of them.

Data structures don't exist on their own.

They live inside components that have a clear responsibility.

Understanding that shift is what separates writing working code from designing maintainable software.


Imagine You're Designing an Order System

A new order is placed.

The system must:

  • store the order,
  • validate payment,
  • reserve inventory,
  • notify the customer,
  • generate analytics,
  • update recommendations.

A beginner may immediately start thinking:

Should I use a Queue?

Should I use a HashMap?

Should I use a Graph?
Enter fullscreen mode Exit fullscreen mode

But notice something.

None of those questions explain who is responsible for doing the work.


Start With Responsibilities

Instead, think about the system like this.

Order Service

↓

Inventory Service

↓

Payment Service

↓

Notification Service

↓

Analytics Service
Enter fullscreen mode Exit fullscreen mode

Each component owns one clear responsibility.

Only after defining that responsibility do you decide how it should manage its data.


Data Structures Support Responsibilities

Suppose the Notification Service needs to process messages in the order they arrive.

Its responsibility suggests:

Queue
Enter fullscreen mode Exit fullscreen mode

The Inventory Service frequently retrieves products by ID.

Its responsibility suggests:

HashMap
Enter fullscreen mode Exit fullscreen mode

A Search Service provides live product suggestions.

Its responsibility suggests:

Trie
Enter fullscreen mode Exit fullscreen mode

A Recommendation Service explores relationships between products.

Its responsibility suggests:

Graph
Enter fullscreen mode Exit fullscreen mode

Notice the pattern.

The responsibility comes first.

The data structure follows naturally.


One Application, Many Data Structures

Real systems rarely rely on just one data structure.

Imagine an e-commerce platform.

Inventory Service

↓

HashMap

-------------------

Notification Service

↓

Queue

-------------------

Recommendation Service

↓

Graph

-------------------

Search Service

↓

Trie

-------------------

Task Scheduler

↓

Heap
Enter fullscreen mode Exit fullscreen mode

Every component chooses the structure that best supports its own behavior.

This is much cleaner than forcing one solution across the entire system.


Why This Matters in LLD

Low-Level Design isn't about placing classes on a diagram.

It's about assigning clear responsibilities.

When responsibilities are clear:

  • components become easier to understand,
  • changes remain localized,
  • testing becomes simpler,
  • implementations can evolve independently.

The data structure becomes an implementation detail inside a well-designed component.


How This Changes Your Design Process

Instead of asking:

"Which data structure should I use?"

Follow this sequence.

Business Requirement

↓

Component Responsibility

↓

Expected Behavior

↓

Data Structure
Enter fullscreen mode Exit fullscreen mode

This keeps the design focused on solving business problems rather than showcasing technical knowledge.


Common Beginner Mistakes

Mistake 1 — Starting With Implementation

Choosing a data structure before defining responsibilities often leads to tightly coupled designs.


Mistake 2 — One Data Structure Everywhere

Different components solve different problems.

Expecting the same structure to fit every responsibility usually creates unnecessary complexity.


Mistake 3 — Mixing Responsibilities

A component responsible for inventory shouldn't also manage recommendations, notifications, and search.

Each responsibility deserves its own boundary.


Mistake 4 — Treating Data Structures as Architecture

A Queue or Graph isn't an architecture.

They're implementation choices that support a component's behavior.

Architecture comes from how responsibilities are organized.


Engineering Perspective

Ask experienced engineers about a new feature.

They rarely begin by discussing HashMaps or Queues.

Instead, they ask questions like:

  • Which component owns this behavior?
  • Where should this responsibility live?
  • Which service should make this decision?
  • How should components collaborate?

Only after those answers are clear do implementation choices naturally emerge.


The Most Important Insight

The best Low-Level Designs aren't built around clever data structures.

They're built around well-defined responsibilities.

Once responsibilities are clear, choosing the right data structure becomes much easier—and often obvious.


One-Line Takeaway

Great engineers don't organize software around data structures—they organize it around responsibilities, and let each responsibility choose the implementation that fits its behavior.

Top comments (0)