gpt4 book ai didi

UML 中的行为与操作

转载 作者:行者123 更新时间:2023-12-04 12:09:27 27 4
gpt4 key购买 nike

尽我所知,

the operation is resides in the second compartment of class at class diagram.



以下是 Behavior definition来自 UML 规范(2011 年 8 月,第 445 页)

13.3.2 Behavior (from BasicBehaviors)

Behavior is a specification of how its context classifier changes state over time. This specification may be either a definition of possible behavior execution or emergent behavior, or a selective illustration of an interesting subset of possible executions. The latter form is typically used for capturing examples, such as a trace of a particular execution. A classifier behavior is always a definition of behavior and not an illustration. It describes the sequence of state changes an instance of a classifier may undergo in the course of its lifetime. Its precise semantics depends on the kind of classifier. For example, the classifier behavior of a collaboration represents emergent behavior of all the parts, whereas the classifier behavior of a class is just the behavior of instances of the class separated from the behaviors of any of its parts. When a behavior is associated as the method of a behavioral feature, it defines the implementation of that feature (i.e., the computation that generates the effects of the behavioral feature).



1)你能解释一下上面定义中的行为是什么意思吗?

2)统一建模语言(UML)中的行为和操作有什么区别?

最佳答案

操作是仅规范的元素 - 将其想象为 OO 编程语言中的方法签名。它有一个名称和一个参数列表。

行为是(除其他外)操作(或其他行为特征,如接收)在调用时所做的事情 - 将其想象为方法的主体。

UML 实际上将定义操作做什么的行为称为“方法”。此外,从行为(无论是事件还是状态机)来看,操作被视为“规范”。

还要注意,在 UML 中操作可以有多种方法。它的含义以及调用操作时应执行的行为取决于相关工具。

最后,行为可以是状态机或事件——事件很容易理解,因为它们相当于过程代码。状态机是完全不同的野兽,我承认我不明白如何将状态机用作操作的行为。

关于UML 中的行为与操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17007720/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com