How do I represent a loop in an activity diagram?

好久不见. 提交于 2019-11-29 01:43:34

问题


I'd like to represent a loop in a UML activity diagram. Here's my situation:

  • For each folder, I check each document within that folder
  • For each document I check its content:
    • If it's invalid (based on keyword searching), do action X and pass to next document.
  • When all document are verified, continue to the next folder.

Can anyone show me what this should look like?


回答1:


There are 3 different notations that you can use.

As your loop is based on some elements (folders, documents) the most convenient way is to use Expansion Region (of iterative type).

Second option, that is a preferred choice when you have some guard based loop is a Loop Node.

The last possibility is to simply build correctly structured decision/merge structure.

The benefits of the first two are that they are compact and clear. It is also easy to have nested loops. Neither of this is true with the last option. Yet if you present your diagram to someone who is not familiar with UML (especially if you have no chance to explain a meaning of particular structure), the last approach usually is most widely recognized and understood.



来源:https://stackoverflow.com/questions/37710695/how-do-i-represent-a-loop-in-an-activity-diagram

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