Bird
0
0

You want to combine the Observer pattern with a caching mechanism to reduce UI update frequency. Which approach is best?

hard📝 Trade-off Q9 of 15
LLD - Design — Chess Game
You want to combine the Observer pattern with a caching mechanism to reduce UI update frequency. Which approach is best?
ACache observer objects instead of data
BNotify observers immediately on every data change
CRemove caching and notify only one observer
DBatch updates and notify observers periodically
Step-by-Step Solution
Solution:
  1. Step 1: Understand caching goal

    Caching aims to reduce frequent UI updates by grouping changes.
  2. Step 2: Apply batch update strategy

    Batching updates and notifying observers periodically reduces update frequency and improves performance.
  3. Final Answer:

    Batch updates and notify observers periodically -> Option D
  4. Quick Check:

    Batching updates reduces UI update frequency [OK]
Quick Trick: Batch updates to reduce UI refresh frequency [OK]
Common Mistakes:
  • Notifying observers immediately defeats caching
  • Removing caching loses performance benefits
  • Caching observer objects instead of data is ineffective

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes