0
0
LLDsystem_design~5 mins

SOLID violations and fixes in LLD - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the Single Responsibility Principle (SRP) state?
SRP means a class should have only one reason to change, meaning it should have only one job or responsibility.
Click to reveal answer
intermediate
What is a common violation of the Open/Closed Principle (OCP)?
Changing existing code to add new features instead of extending it. This makes the system fragile and hard to maintain.
Click to reveal answer
intermediate
How can the Liskov Substitution Principle (LSP) be violated?
When a subclass changes the expected behavior of the parent class, causing errors when used in place of the parent.
Click to reveal answer
beginner
What does the Interface Segregation Principle (ISP) recommend?
Clients should not be forced to depend on interfaces they do not use. Use many small, specific interfaces instead of one large one.
Click to reveal answer
intermediate
How does the Dependency Inversion Principle (DIP) improve design?
By depending on abstractions (interfaces) rather than concrete classes, making the system flexible and easier to change.
Click to reveal answer
Which SOLID principle is violated if a class handles multiple unrelated tasks?
ALiskov Substitution Principle
BOpen/Closed Principle
CSingle Responsibility Principle
DDependency Inversion Principle
What is a fix for violating the Open/Closed Principle?
AExtend classes using inheritance or composition
BModify existing classes for new features
CRemove interfaces
DUse global variables
If a subclass breaks the behavior expected from its parent, which principle is violated?
AInterface Segregation Principle
BLiskov Substitution Principle
CDependency Inversion Principle
DSingle Responsibility Principle
What does Interface Segregation Principle encourage?
AMany small, specific interfaces
BOne large interface for all clients
CNo interfaces at all
DUsing abstract classes only
Dependency Inversion Principle suggests depending on:
AConcrete classes
BStatic methods
CGlobal variables
DAbstractions (interfaces)
Explain how you would fix a class that violates the Single Responsibility Principle.
Think about dividing jobs like splitting household chores among family members.
You got /3 concepts.
    Describe how the Dependency Inversion Principle helps in making a system easier to maintain.
    Imagine using a universal remote that works with many devices instead of a fixed one.
    You got /3 concepts.