[英]UML Use-Case Diagram
I'm drawing a UML use-case diagram for the following scenario:我正在为以下场景绘制 UML 用例图:
So my 2 actors would be: the event generated by this external system and the user that receives the notification.所以我的 2 个参与者是:这个外部系统生成的事件和接收通知的用户。
Now, I'm not certain on how to model the other items in my initial list of they should be modeled at all.现在,我不确定如何对我的初始列表中的其他项目进行建模,这些项目应该完全建模。
Should I have something like:我应该有类似的东西:
Should I model the discard event at all?我应该完全模拟丢弃事件吗?
Thanks!谢谢!
Let's look at the definitions.让我们看看定义。
I will use a definition from UML Specification , section 18.1.3.1我将使用UML 规范18.1.3.1 节中的定义
An Actor models a type of role played by an entity that interacts with the subjects of its associated UseCases (eg, by exchanging signals and data).
Actor 对实体所扮演的角色类型进行建模,该实体与其关联的用例的主题进行交互(例如,通过交换信号和数据)。 Actors may represent roles played by human users, external hardware, or other systems
参与者可能代表人类用户、外部硬件或其他系统所扮演的角色
It clearly states a close list of who/what can become an Actor.它清楚地列出了谁/什么可以成为演员的详细名单。 In your case, it is an
External System
that interacts with your system so it is your Actor.在您的情况下,它是一个与您的系统交互的
External System
,因此它是您的 Actor。 The other Actor is naturally User
.另一个 Actor 自然是
User
。
Here I will support myself with the definition from Alistair Cockburn's "Writing Effective Use Cases" book (section 1.1).在这里,我将使用 Alistair Cockburn 的“编写有效用例”一书(第 1.1 节)中的定义来支持自己。
A use case captures a contract between the stakeholders of a system about its behavior.
用例捕获系统利益相关者之间关于其行为的契约。 The use case describes the system's behavior under various conditions as it responds to a request from one of the stakeholders, called the primary actor.
用例描述了系统在各种条件下的行为,因为它响应来自一个利益相关者(称为主要参与者)的请求。 The primary actor initiates an interaction with the system to accomplish some goal.
主要参与者发起与系统的交互以完成某个目标。 The system responds, protecting the interests of all the stakeholders.
系统响应,保护所有利益相关者的利益。 Different sequences of behavior, or scenarios, can unfold, depending on the particular requests made and conditions surrounding the requests.
根据提出的特定请求和请求周围的条件,可以展开不同的行为序列或场景。 The use case collects together those different scenarios.
用例将这些不同的场景收集在一起。
In your case, it is apparent that once the External System
(primary Actor) provides an event, the processing is then carried out by your system until either the User
(secondary Actor) is notified or the event is discarded.在您的情况下,很明显,一旦
External System
(主要参与者)提供事件,处理就会由您的系统执行,直到通知User
(次要参与者)或事件被丢弃。 It seems that there are no delays or further interactions required in order to accomplish this goal so it is clearly just one use case, Ingest event
.为了实现这一目标,似乎不需要延迟或进一步的交互,所以它显然只是一个用例,
Ingest event
。
The processing ending by notifying the User
will be your main path while the one where the event gets discarded will be either an alternative or even a negative path (depending on how you look at it).通过通知
User
结束的处理将是您的主要路径,而事件被丢弃的路径将是替代路径甚至是负面路径(取决于您如何看待它)。
If you consider the discard as an alternative path, you should model the multiplicity of the association to the User
as 0..1
to show the User
is not always notified.如果您将丢弃视为替代路径,则应将与
User
关联的多重性建模为0..1
以显示User
并不总是得到通知。 You do not have to do that if you account this as a negative path, as those are considered "failure paths" so not all tasks of the UC has to happen.如果您将此视为负面路径,则不必这样做,因为这些被视为“失败路径”,因此并非 UC 的所有任务都必须发生。 I would be very careful though.
不过我会非常小心。 Since you expect discarding to be something happening on a regular basis it seems to be an alternative path rather than a negative one.
由于您希望丢弃是定期发生的事情,因此它似乎是一种替代途径而不是消极途径。
The assumption in my model is that you actively notify the User
(eg send him a push, a mail or do some other action).我的模型中的假设是您主动通知
User
(例如向他发送推送、邮件或执行其他操作)。
It might be possible though that you just create a notification and the User
has to actively read it.尽管您只是创建了一个通知并且
User
必须主动阅读它,但也有可能。 In such case, User
would not be an Actor of Ingest event
at all.在这种情况下,
User
根本不是Ingest event
的Ingest event
。 Instead, as a result of Ingest event
you create a notification (not visible on UC diagram).相反,作为
Ingest event
的结果,您会创建一个通知(在 UC 图上不可见)。 In addition, User
needs an additional use case to Read notifications
, in which he is the primary (initiating) Actor.此外,
User
需要一个额外的用例来Read notifications
,其中他是主要(发起)Actor。
You only have one Use Case in your scenario: Ingest event
.您的场景中只有一个用例:
Ingest event
。
Your Actors are: External System
(primary) and User
(secondary with multiplicity 0..1
).您的演员是:
External System
(主要)和User
(次要,多重性0..1
)。
Event
is no actor.Event
不是演员。 Event
is an event. Event
是一个事件。 If you don't have a specific name call it External system
.External system
。Ingest event
would be ok as UC. Ingest event
可以作为 UC。Ingest event
.Ingest event
。 Same for discarding it.Inform User
--- User
.Inform User
--- User
。Inform User
's activities.Inform User
活动中的一个路径。 Generally:一般来说:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.