Bird
Raised Fist0

Why is it important to separate User, Group, and Expense classes in a shared expense system design?

hard🧠 Conceptual Q10 of Q15
LLD - Design — Splitwise (Expense Sharing)
Why is it important to separate User, Group, and Expense classes in a shared expense system design?
ATo ensure single responsibility and easier maintenance
BTo reduce the number of classes in the system
CTo make all data accessible from one class
DTo avoid using inheritance in the system
Step-by-Step Solution
Solution:
  1. Step 1: Recall design principles

    Single Responsibility Principle states each class should have one responsibility.
  2. Step 2: Benefits of separation

    Separating classes improves clarity, maintenance, and scalability.
  3. Final Answer:

    To ensure single responsibility and easier maintenance -> Option A
  4. Quick Check:

    Separation = Single Responsibility [OK]
Quick Trick: Separate classes for clear roles and easier updates [OK]
Common Mistakes:
MISTAKES
  • Thinking fewer classes is always better
  • Trying to put all data in one class
  • Confusing separation with inheritance avoidance

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes