Bird
0
0

In a system where moves must be validated for both boundary and occupancy, which design approach best ensures scalability and maintainability?

hard📝 Trade-off Q15 of 15
LLD - Design — Tic-Tac-Toe Game
In a system where moves must be validated for both boundary and occupancy, which design approach best ensures scalability and maintainability?
AUse separate modular validators for boundary and occupancy checks, composed in sequence
BCombine all validation logic in a single monolithic function
CSkip occupancy checks to improve performance
DValidate moves only after applying them to the system state
Step-by-Step Solution
Solution:
  1. Step 1: Consider modular design benefits

    Separating boundary and occupancy checks into modules improves clarity and reusability.
  2. Step 2: Evaluate scalability and maintainability

    Modular validators can be updated independently and composed flexibly, aiding scalability.
  3. Final Answer:

    Use separate modular validators for boundary and occupancy checks, composed in sequence -> Option A
  4. Quick Check:

    Modular design = scalable and maintainable [OK]
Quick Trick: Modular validation improves system scalability and clarity [OK]
Common Mistakes:
MISTAKES
  • Combining all logic makes code hard to maintain
  • Skipping important checks reduces reliability
  • Validating after applying moves risks inconsistent state

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes