开发者

command design pattern usage

开发者 https://www.devze.com 2022-12-28 23:59 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消