Bird
0
0

How can you combine a room type hierarchy with a feature flag system to enable or disable features like video conferencing in certain room types dynamically?

hard📝 Trade-off Q9 of 15
LLD - Design — Hotel Booking System
How can you combine a room type hierarchy with a feature flag system to enable or disable features like video conferencing in certain room types dynamically?
AHardcode all features in subclasses without flags
BUse feature flags only, no inheritance
CUse inheritance for room types and add feature flags as attributes checked at runtime
DCreate separate classes for each feature without linking to room types
Step-by-Step Solution
Solution:
  1. Step 1: Understand combining hierarchy and feature flags

    Inheritance models room types; feature flags enable/disable features dynamically.
  2. Step 2: Evaluate design options

    Hardcoding or ignoring inheritance reduces flexibility; separate classes lose cohesion.
  3. Final Answer:

    Use inheritance for room types and add feature flags as attributes checked at runtime -> Option C
  4. Quick Check:

    Combine inheritance + feature flags for flexibility [OK]
Quick Trick: Use flags with inheritance to toggle features dynamically [OK]
Common Mistakes:
  • Hardcoding features without flags
  • Ignoring inheritance benefits
  • Separating features from room types

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes