0
0
LLDsystem_design~5 mins

User, Group, Expense classes in LLD - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the primary responsibility of the User class in an expense management system?
The User class represents an individual who can participate in groups and record or share expenses. It typically holds user details like name, email, and unique ID.
Click to reveal answer
beginner
How does the Group class help in managing expenses?
The Group class organizes multiple users into a collection where expenses can be shared and tracked collectively. It manages group members and their shared expenses.
Click to reveal answer
beginner
What key attributes should the Expense class have?
The Expense class should include attributes like amount, description, date, payer (User), and participants (Users who share the expense).
Click to reveal answer
intermediate
Why is it important for the Expense class to track participants separately from the payer?
Tracking participants separately allows the system to split the expense fairly or by custom shares among users, while the payer is the one who initially paid the amount.
Click to reveal answer
intermediate
How can the Group class maintain scalability when handling many users and expenses?
By using efficient data structures like hash maps for quick user lookup, and by separating expense records to avoid large monolithic objects, the Group class can scale well.
Click to reveal answer
Which class should store the list of users who share a particular expense?
AExpense
BUser
CGroup
DNone of the above
In an expense system, who is responsible for paying the amount initially?
AGroup
BExpense
CUser (payer)
DAll participants
What does the Group class primarily manage?
AExpense splitting logic
BCollection of users and their shared expenses
CIndividual user details
DPayment processing
Which attribute is NOT typically part of the Expense class?
AGroup name
BDate
CAmount
DDescription
Why separate payer and participants in an expense?
ATo avoid duplicate users
BTo reduce storage space
CTo speed up calculations
DTo identify who paid and who owes money
Describe the roles and key attributes of User, Group, and Expense classes in an expense sharing system.
Think about who pays, who shares, and how groups organize users.
You got /3 concepts.
    Explain why it is important to track both the payer and participants separately in the Expense class.
    Consider a dinner bill paid by one but shared by many.
    You got /3 concepts.