如何在活动图中表示循环? [英] How do I represent a loop in an activity diagram?

查看:114
本文介绍了如何在活动图中表示循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 UML 活动图中表示一个循环.这是我的情况:

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

  • 对于每个文件夹,我都会检查该文件夹中的每个文档
  • 对于每个文档,我都会检查其内容:
    • 如果无效(基于关键字搜索),则执行操作 X 并传递到下一个文档.

    谁能告诉我这应该是什么样子?

    Can anyone show me what this should look like?

    推荐答案

    您可以使用 3 种不同的表示法.

    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.

    前两个的好处是它们简洁明了.嵌套循环也很容易.对于最后一个选项,这两者都不是真的.然而,如果您将您的图表展示给不熟悉 UML 的人(尤其是当您没有机会解释特定结构的含义时),通常最后一种方法会得到最广泛的认可和理解.

    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.

    这篇关于如何在活动图中表示循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆