command design pattern usage
I've read 3 descriptions of the command design pattern: wikipedia, dofactory and source making.
In all of them, the UML shows a relation between the client to the receiver & the concrete command, but no relation to the invoker. But in all 3 examples the client is th开发者_Go百科e one that initiates the invoker and call its Execute method.
I think that should be a relation to the invoker as well. Am I missing somthing in here? Maybe even a basic UML knowladge?
That's probably a limitation of the simple examples. There is no need to have a relationship between the client and the invoker in practice.
The client could serialise the command object and send it to a remote service for execution for example, or the client may add the command to a queue for another thread to de-queue and execute later on.
精彩评论