UML中信号和异步操作之间的差异是什么?

发布于 2025-02-04 05:15:33 字数 59 浏览 1 评论 0原文

制作序列图,我的工具允许交流是同步操作,异步操作和信号。

最后两个关于程序流的区别是什么?

Making sequence diagrams my tool allows for communication that is either synchronous operation, asynchronous operation, and signal.

What's the difference between the last two regarding program flow?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

红颜悴 2025-02-11 05:15:33

信号 用于异步事件驱动的通信。信号是分类器,描述了它们出现的属性。本身课程并在接收部分中指示他们能够处理的信号,在交互图中,您可以使用这些信号。

在序列图中,使用 消息

消息的签名是指操作或信号。消息的名称必须与引用操作或信号的名称相同。

操作的图形符号和序列图中的信号是相同的。只是信号一定总是异步的。好消息是您可以从一个开始,然后决定切换到另一个,而无需从根本上更改序列图。

没有规则可以使用一个或另一个规则。您可以使用一个或另一个设计非常相似的设计建模。在类型上,您可能更喜欢信号而不是异步操作:

  • 如果您正在设计事件驱动的系统,
  • 如果您正在设计分布式系统,并且许多中介机构在消息
  • 对发件人有意义的情况下,无论接收者无论接收者,消息都有意义。这种情况的一种症状是,潜在的无关类(拥有不同的操作)可能对接收和处理此类信息感兴趣。
  • 如果消息的内容很复杂:而不是使用许多参数的操作,而不是使用类参数的操作,而该类别仅创建了用于简化呼叫参数的类别,而是信号可以允许对消息的内容进行建模。

Signals are meant for asynchronous event driven communication. The signals are classifiers, that describe the attributes of their occurence. Classes themselves and indicate in the reception section which signals they are able to process, and in interaction diagrams you can then use these signals.

In a sequence diagram, the communication between two lifelines is achieved using Messages:

The signature of a Message refers to either an Operation or a Signal. The name of the Message must be the same as the name of the referenced Operation or Signal.

The graphical notation for operation and signals in sequence diagrams is the same; it's just that signals are necessarily always asynchronous. The good news is that you can start with one, and decide to switch to the other without fundamentally changing your sequence diagram.

There is no rule to use the one or the other. You could model very similar designs using the one or the other. Typcially, you may prefer signals over asynchronous operations:

  • if you're designing an event-driven system,
  • if you're designing a distributed system, with many intermediaries relaying your message
  • if the message is meaningful for the sender regardless of the receiver. One symptom of this situation is that potentially unrelated classes (having different operations) could be interested in receiving and processing such message.
  • if the content of the message is complex: instead of an operation with many arguments, and instead of an operation using a class argument where the class was solely created for simplifying the call arguments, the signal could allow to model the content of the message.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文