<aside>

This section is part of the 5-hour LLD course by Mukul Raina

SLIDE 25: Section Intro: SOLID Principles for Interviews

Section 3: SOLID Principles for Interviews

SOLID is a set of five design principles that guide how you structure classes and their relationships. In LLD interviews, SOLID is not tested as theory. Interviewers evaluate whether you instinctively apply these principles when designing classes, and whether you can spot violations when they probe your design. The principles build directly on the OOP foundations from Section 2: SRP refines encapsulation, OCP formalizes polymorphism for extensibility, LSP constrains inheritance, ISP refines abstraction, and DIP enforces composition over concrete dependencies.

What We Will Cover

  1. Single Responsibility Principle (SRP): what “one reason to change” actually means
  2. Open-Closed Principle (OCP): designing for extension without modification
  3. Liskov Substitution Principle (LSP): behavioral subtyping, not just type compatibility
  4. Interface Segregation Principle (ISP): fat interfaces vs focused interfaces
  5. Dependency Inversion Principle (DIP): depending on abstractions, not implementations
  6. SOLID violations as code smells: a quick recognition guide for interviews

Where SOLID Appears in LLD Interviews

Interview Moment What the Interviewer Is Testing
“How would you add a new feature?” OCP: can you extend without modifying existing code?
“This class is doing too much” SRP: can you decompose responsibilities?
“What if we swap this implementation?” DIP: are your dependencies on abstractions?
“Does this subclass really belong here?” LSP: does the subclass honor the parent’s contract?
“Your interface is too large” ISP: can you break it into focused contracts?
Design review / code walkthrough All five: can you spot violations in your own design?

<aside>

Mukul Raina | youtube.com/@mukulraina | slides.mukulraina.com | LinkedIn

</aside>


SLIDE 26: Single Responsibility Principle: What “One Reason to Change” Means

The Single Responsibility Principle states that a class should have only one reason to change. This is the most frequently misunderstood SOLID principle because “one responsibility” sounds vague. The precise definition is about change drivers: a class should be affected by changes from exactly one source.

A change driver is a stakeholder, a business domain, or a technical concern that could independently require modifications to the class. If two unrelated changes (a new business rule for pricing AND a new format for log output) both require editing the same class, that class has more than one responsibility.

Concrete Example