首页 > 解决方案 > 这个序列的最佳 UML 图是什么?

问题描述

我目前正在学校完成我的期末项目。并且即将毕业。我一直在使用 UML 图时遇到困难,我正在努力决定应该使用哪一个来描绘我的代码。

我的代码是一个 python 脚本,并包含一个按以下方式工作的循环:

I run the script from a terminal -> 
   Terminal listens to two keys (W & Q).  
If Q is pressed the script stops. 
If W is pressed the loop begins in the following order:  
  Raspberry Pi camera takes a picture ->  
  Crop specific portion out of said picture and save it ->  
  Run Text recognition on that picture, which returns a text string and is saved in a variable ->  
  Run Regex to filter out junk characters from text string and create new "clean" text string ->  
  Run GET request to website using clean text string, and get return based on it. ->  
  Print out response from request.

哪个图表是使这个序列易于理解的最佳选择。我研究了各种图表,例如系统序列图等。但我还没有找到任何对我来说真正有意义的东西。我应该求助于使用流程图吗?或者有什么更适合我使用的东西吗?

标签: umlmodelingdiagramcontrol-flow

解决方案


您想使用事件驱动的流程链 (EPC)。

在这种情况下(没有看到您的代码),我建议使用“事件驱动的流程链”简称:(EPC) , [德语: (EPK), Ereignisgesteuerte Prozesskette]

UMLs 大多数时候习惯于显示“类结构”而不是链/脚本中的过程。

EPC 使用逻辑运算符,例如 OR、AND 和 XOR,它们可以表示如下事件:

'终端监听两个键(W & Q)' => XOR -> W ->Q

在此处输入图像描述

你可以在这里阅读更多关于它的信息。

编辑:

如果您仅限于 UML 图:

在七个行为 UML 图中,您确实应该使用用户 qwerty_so 建议的“UML 活动图”。它类似于 EPC,可以描述为 UML 的“流程图”变体。

UML 图仅限于六个“结构”UML 图和七个“行为”UML 图

行为 UML 图

  1. 活动图
  2. 序列图
  3. 用例图
  4. 状态图
  5. 通讯图
  6. 交互概览图
  7. 时序图

您可以在此处阅读有关活动图的更多信息。

您可以在此处阅读有关 UML 图类型的更多信息。


推荐阅读