InterviewSolution
| 1. |
What Are The Responsibilities Of Invoker And Receiver In Command Pattern? |
|
Answer» There are two main actors, the invoker and the receiver in Command pattern. Invoker : Invoker is a piece of code which can EXECUTE some imperative logic. Typically, it is a UI element that the user interacts with in the CONTEXT of a UI framework. But it COULD just be ANOTHER chunk of logic code somewhere else in the application. Receiver : Receiver is the logic that is intended for execution when the invoker fires. In the context of MVVM, the receiver is typically a method in your ViewModel that needs to be CALLED. There are two main actors, the invoker and the receiver in Command pattern. Invoker : Invoker is a piece of code which can execute some imperative logic. Typically, it is a UI element that the user interacts with in the context of a UI framework. But it could just be another chunk of logic code somewhere else in the application. Receiver : Receiver is the logic that is intended for execution when the invoker fires. In the context of MVVM, the receiver is typically a method in your ViewModel that needs to be called. |
|