Bird
0
0

Why is the Command pattern considered a behavioral design pattern?

hard🧠 Conceptual Q10 of 15
LLD - Behavioral Design Patterns — Part 1
Why is the Command pattern considered a behavioral design pattern?
ABecause it manages memory allocation.
BBecause it defines the structure of classes and objects.
CBecause it improves system performance by caching.
DBecause it encapsulates a request as an object to separate behavior from invoker.
Step-by-Step Solution
Solution:
  1. Step 1: Recall behavioral pattern definition

    Behavioral patterns focus on communication between objects and how they interact.
  2. Step 2: Command pattern behavior encapsulation

    Command encapsulates requests as objects, separating the behavior from the invoker, fitting behavioral pattern traits.
  3. Final Answer:

    It encapsulates a request as an object to separate behavior from invoker. -> Option D
  4. Quick Check:

    Command pattern = behavioral pattern due to encapsulating behavior [OK]
Quick Trick: Behavioral patterns manage object communication [OK]
Common Mistakes:
MISTAKES
  • Confusing behavioral with structural patterns
  • Thinking it improves performance directly
  • Assuming it manages memory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes