Which is of the following statements is true about the Command Pattern? (Check a
ID: 3919521 • Letter: W
Question
Which is of the following statements is true about the Command Pattern? (Check all that are correct. More than one answer is possible)
A. It is the same as Chain of Responsibility pattern combined with Facade pattern.
B. The main Command Class must have a private Constructor.
C. It facilitates the undo operation.
D. It must always be used as a Singleton Pattern Class.
E. It calls the relevant function indirectly.
F. The Command Pattern can be used to keep a list of operations to be able to undo them when it is required.
Explanation / Answer
Answer is as follows :
Accorrding to given scenario the correct options are :
C. It facilitates the undo operation.
E. It calls the relevant function indirectly.
F. The Command Pattern can be used to keep a list of operations to be able to undo them when it is required.
Wrong Options :
A is wrong because it only works as Chain of Responsobility using a separate object for each invocation of a command, it can't use any facade pattern.
B is wrong becasue there is no need of private constructor, it can be public also.
D is wrong becasue, it can't be used as singleton pattern becasue it is type of creational pattern and command pattern is behavioural pattern.
if there is any query please ask in comments...
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.