Representing loops in a UML communication diagram

心不动则不痛 提交于 2019-12-08 10:19:32

问题


Given the following sequence diagram, how to express the equivalent in a UML communication diagram?

Edit This is slightly different from How to express loops in Communication Diagrams? because there are two messages in the loop.

I see the link to http://www.smartdraw.com/resources/tutorials/uml-collaboration-diagrams/ which mentions the * for a loop.

Would it be right then to use:

1 * [i=1..5] : hello
2 * [i=1..5] : bye

The trouble I see is that this seems to be ambiguous: is it hello x 5 then bye x 5, or (hello bye) x 5.


回答1:


I don't think it can be done. The whole idea of collaboration diagrams is to use them when you have simple object interaction. Why not use a sequence diagram?




回答2:


Try to aggregate them. Introduce these instead:

1 * [i=1..5] : hellobye
1.1 : hello
1.2 : bye


来源:https://stackoverflow.com/questions/10202095/representing-loops-in-a-uml-communication-diagram

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