Bird
Raised Fist0

If the Library Management System must support inter-library loans (borrowing books from other branches), which design change best supports this feature without compromising existing loan and reservation logic?

hard🎤 Interviewer Follow-up Q10 of Q15
OOP & Design Patterns - Design a Library Management System - LLD with Relationships & Edge Cases
If the Library Management System must support inter-library loans (borrowing books from other branches), which design change best supports this feature without compromising existing loan and reservation logic?
AMerge all branch inventories into a single global catalog and ignore branch distinctions
BExtend the LoanManager to handle cross-branch loans with additional status and routing logic
CCreate a separate InterLibraryLoanManager that operates independently from branch LoanManagers
DAllow users to directly borrow from any branch without updating the local LoanManager
Step-by-Step Solution
Solution:
  1. Step 1: Identify integration needs for inter-library loans

    Inter-library loans require coordination between branches but must integrate with existing loan and reservation logic.
  2. Step 2: Extend existing LoanManager functionality

    Adding cross-branch handling within LoanManager maintains consistency and reuses existing logic.
  3. Step 3: Reject global catalog and independent managers

    Merging inventories loses branch-specific info; separate managers risk inconsistent state.
  4. Step 4: Reject direct borrowing without updates

    Bypassing LoanManager breaks tracking and reservation correctness.
  5. Final Answer:

    Option B -> Option B
  6. Quick Check:

    Extending LoanManager supports inter-library loans cleanly [OK]
Quick Trick: Integrate inter-library loans into LoanManager [OK]
Common Mistakes:
MISTAKES
  • Ignoring branch distinctions in global catalog
  • Creating isolated managers causing inconsistency
  • Bypassing loan tracking for cross-branch loans
Trap Explanation:
PITFALL
  • Candidates may pick isolated or naive solutions ignoring system-wide consistency.
Interviewer Note:
CONTEXT
  • Tests ability to extend complex systems without breaking existing logic.
Master "Design a Library Management System - LLD with Relationships & Edge Cases" in OOP & Design Patterns

2 interactive learning modes - each teaches the same concept differently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More OOP & Design Patterns Quizzes