绘制 UML 状态图

发布于 2024-08-14 18:53:39 字数 317 浏览 11 评论 0原文

绘制状态图时,如何知道哪些状态被放入框中以及哪些状态用于转换箭头?我注意到转换也是状态。

我正在此页面上查看图1:

在此处输入图像描述

When drawing state diagrams, how do you know which states get put in boxes and which states are for the transition arrows? I noticed that transitions are states too.

I'm looking at figure 1 on this page:

enter image description here

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

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

发布评论

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

评论(4

夕色琉璃 2024-08-21 18:53:39

转换不是状态。转换是将对象从一种状态移动到下一种状态的事件。状态由对象中的变量值和对象的行为定义。以具有“新等待批准”值的 Student 对象为例。该学生不得注册或上课。但如果值更改为“已批准”,则可能会允许同一学生注册并上课。有什么区别?学生对象实际上有两种状态。

是什么导致 Student 对象从一种状态转移到另一种状态?也许是“批准到来”事件。因此,“批准到达”沿着两个州之间的箭头移动。

Transitions are NOT states. Transitions are the events that move an object from one state to the next. States are defined by the value of variables in the object and by the behaviour of the object. Take for instance a Student object that has a value "new-waiting for approval" value. That student is not allowed to register for or attend classes. But the same student may be allowed to register for and attend classes if the value changes to "approved". What's the difference? The student object actually has two states.

What causes the Student object to move from one state to the next? The event "Approval Arrives" maybe. So Approval Arrives go on the arrow between two states.

楠木可依 2024-08-21 18:53:39

图中的“转换箭头”不是状态,它们是“转换/动作/发生”。例如,在上述图中,“已计划”是状态,“开放”是进入“开放注册”状态后的操作。这种“打开”转换可以用“正在打开”来替换更详细的内容
不幸的是,像计划/打开这样的转换操作也很容易与状态混淆,但这不是意图。

'Transition arrows' in the diagram are not states, they are "TRANSITION/ACTION/HAPPENING". For e.g. in the mentioned figure, "Scheduled" is the state, open is action after which it goes to "Open for enrollment" state. This "open" transition can be replaced more verbose with "is being opened"
Unfortunately, the transition actions like scheduled/open are very easily confused for a state as well, but that is not the intent.

橘香 2024-08-21 18:53:39

首先,您需要识别系统中的对象。在这些对象中,您需要选择随时间变化的概率的对象。然后您需要分别为所有这些选定的对象绘制状态图。方框代表该对象的状态,箭头代表导致状态改变的活动的特定对象。

At first you need to identify objects in your system. Among those objects, You need to select objects which have probability of change over the time.Then You need to draw state diagrams for all those selected objects separately.Boxes represent the states of that object and arrow represents the activity which causes to change the state of particular object.

谜兔 2024-08-21 18:53:39

我同意一点,在规范中,在某些示例中,转换看起来像状态。
状态图

对我来说“selectAmount”并不完全是一个州名......

I agree of one point, in specification , on some example, transitions looks like state.
state diagrame

For me "selectAmount" is not exactly a state name ...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文