Bird
0
0

Which advantage does the Command pattern provide when implementing undo operations in software design?

easy🧠 Conceptual Q1 of 15
LLD - Design — Tic-Tac-Toe Game
Which advantage does the Command pattern provide when implementing undo operations in software design?
AIt decouples the object that invokes the operation from the one that knows how to perform it
BIt eliminates the need for storing previous states for undo
CIt automatically logs all user actions without additional code
DIt requires no additional memory overhead for undo functionality
Step-by-Step Solution
Solution:
  1. Step 1: Understand Command pattern role

    The Command pattern encapsulates a request as an object, allowing parameterization and queuing.
  2. Step 2: Decoupling invoker and executor

    This separation allows the invoker to issue commands without knowing their implementation, facilitating undo.
  3. Final Answer:

    It decouples the object that invokes the operation from the one that knows how to perform it -> Option A
  4. Quick Check:

    Decoupling is key for flexible undo [OK]
Quick Trick: Command pattern decouples invoker and executor [OK]
Common Mistakes:
MISTAKES
  • Assuming undo requires no state storage
  • Believing Command pattern auto-logs actions
  • Thinking undo needs no memory overhead

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes