jeudi 10 septembre 2015

Command Pattern:Why Client should know about reciever

Command Pattern Says :Client - creates a ConcreteCommand object and sets its receiver;

Why command pattern should know about receiver.In classical example of Restaurant.

Only Concrete command should should know about receiver. Invoker(Waiter) will have information about ICommand. But when I see many examples :A receiver is created in main and a concrete command is also created in main.

Why they should be in Main where is decoupling between client and Receiver.

If we go back to classical example.If have receiver in main means

Customer will know about chef. Why Customer need to know about Chef?

If we have multiple receivers then customer needs to know about all chefs

Please help me to understand.

Aucun commentaire:

Enregistrer un commentaire