lundi 8 février 2016

How Commnd pattern decouples the sender from reciever?

Command pattern has IReciever interface with few methods and corresponding to each method there are Concrete Command objects (implementing an interface ICommand with execute() method). I have read client knows about the concrete receiver and concrete command and it is usually client setting up the receiver object in the concrete command object. Then why it is said it decouples the sender and the receiver. When client already knows the concrete receiver then I feel this is not loose coupling and also client in this case can directly call the APIs (methods) on the receiver object. Regards, Krishna

Aucun commentaire:

Enregistrer un commentaire