How to use UML to model interaction between server and agent?

我是研究僧i 提交于 2019-12-13 07:37:40

问题


Scenario:

  1. The agent listens to a certain address/port during start up.
  2. When server started, server will send message to agent via the address (multicast). Agent will reply the server.

How to model the first statement using UML (sequence diagram/activity/statemachine) ?


回答1:


I guess any of these types of diagrams could model the interaction, but I would go with a sequence or a communication diagram for these reasons:

  • there is a mix of asynchronous (the server's message) and synchronous (the agent's response) messages;
  • we aren't modelling state changes either in the server or in the agent.

This would be my take on a sequence diagram for the interaction (could possibly include more agents/port listeners to show the multicast):

And on a communication diagram (Agent 0 and Agent 1 could just be called Port Listener 0 and Port Listener 1):

Statement (1), which I take to be the agent listening to the address or port, is shown as a self-call in both cases.

Here are a couple of amusing articles on sequence diagrams:

  • Introduction to UML 2.0 Sequence Diagrams
  • Messages in UML 2.0 Sequence Diagrams.


来源:https://stackoverflow.com/questions/9921943/how-to-use-uml-to-model-interaction-between-server-and-agent

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!