0
0
LLDsystem_design~20 mins

DRY (Don't Repeat Yourself) in LLD - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
DRY Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why is DRY important in system design?

Imagine you are designing a system with multiple modules that share similar logic. Why should you apply the DRY principle?

ATo reduce code duplication and make maintenance easier
BTo increase the number of lines of code for clarity
CTo make each module completely independent with no shared code
DTo add more comments explaining repeated code
Attempts:
2 left
💡 Hint

Think about how repeating the same code affects fixing bugs or adding features.

Architecture
intermediate
2:00remaining
Which design best follows DRY for shared validation logic?

You have multiple services that need to validate user input in the same way. Which architecture approach best follows DRY?

AEach service implements its own validation code separately
BCopy validation code from one service to others when needed
CCreate a shared validation library used by all services
DSkip validation to avoid repeating code
Attempts:
2 left
💡 Hint

Think about how to reuse code without copying it.

scaling
advanced
2:00remaining
How does DRY help when scaling a system?

When a system grows and new features are added, how does following DRY help with scaling?

AIt forces rewriting all code for each new feature
BIt reduces the effort to update shared logic, making scaling faster and less error-prone
CIt increases code duplication, which helps isolate features
DIt makes the system slower by adding extra layers
Attempts:
2 left
💡 Hint

Think about how shared code affects adding or changing features.

tradeoff
advanced
2:00remaining
What is a potential downside of applying DRY too aggressively?

Applying DRY is good, but what problem can happen if you try to share code too much?

AIt always improves performance without any downside
BIt causes code duplication to increase
CIt makes the system impossible to test
DIt can create tight coupling making changes risky and complex
Attempts:
2 left
💡 Hint

Think about what happens if many parts depend on the same code.

component
expert
3:00remaining
In a microservices system, how to apply DRY for common logging?

You have many microservices that need consistent logging. Which approach best applies DRY?

AUse a centralized logging service or library shared by all microservices
BImplement logging code separately in each microservice
CCopy logging code from one microservice to others when needed
DAvoid logging to reduce code repetition
Attempts:
2 left
💡 Hint

Think about how to reuse logging logic without duplication across services.