简体   繁体   English

UML 用例图

[英]UML Use-Case Diagram

I'm drawing a UML use-case diagram for the following scenario:我正在为以下场景绘制 UML 用例图:

  1. External system provides an event - I think my actor here would be the event generated外部系统提供了一个事件 - 我认为这里的演员将是生成的事件
  2. System ingests the event系统摄取事件
  3. System enriches the event系统丰富活动
  4. System correlates enriched event with some data existing in the system系统将丰富的事件与系统中存在的一些数据相关联
  5. If system finds a hit notification is sent to human actor如果系统发现一个命中通知被发送给人类演员
  6. If not, event is discarded如果不是,则丢弃事件

So my 2 actors would be: the event generated by this external system and the user that receives the notification.所以我的 2 个参与者是:这个外部系统生成的事件和接收通知的用户。

  • The event calls use case Ingest event use case事件调用用例Ingest 事件用例
  • The external user uses Receive notification use case外部用户使用接收通知用例

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:我应该有类似的东西:

  • Event (actor) - Generate notification (use case) - User (actor)事件(参与者)- 生成通知(用例)- 用户(参与者)
  • and then some relationships between Generate Notification use case and other uses cases: ingest event, enrich event, correlate event ?然后生成通知用例和其他用例之间的一些关系:摄取事件、丰富事件、关联事件?

Should I model the discard event at all?我应该完全模拟丢弃事件吗?

Thanks!谢谢!

Let's look at the definitions.让我们看看定义。

Actor演员

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

Use Case用例

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.由于您希望丢弃是定期发生的事情,因此它似乎是一种替代途径而不是消极途径。

Alternative approach替代方法

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 eventIngest 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。

Summary (TL;DR)总结 (TL;DR)

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 )。

  • For your actor: 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。
  • I'd guess that enrichment goes with Ingest event .我猜想丰富与Ingest event Same for discarding it.丢弃它也是如此。 Both are activities inside the use case.两者都是用例内的活动。
  • Correlation and sending to the user would be (UC---Actor) Inform User --- User .关联并发送给用户将是 (UC---Actor) Inform User --- User
  • Not informing the user would be a path inside the Inform User 's activities.不通知用户将是Inform User活动中的一个路径。

Generally:一般来说:

  • Use cases show added value the system under consideration delivers to one of its actors.用例显示了所考虑的系统为其参与者之一提供的附加价值。
  • Use cases are no functions (those are hidden inside the UC's activities).用例不是功能(那些隐藏在 UC 的活动中)。
  • If a UC does not add value, it is no use case.如果 UC 没有增加价值,那就不是用例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在这种情况下使用 onclick 事件处理程序是否可以接受? - Is it acceptable to use the onclick event handler in this case? 为什么 onChange 在一个特定用例中不触发? - Why doesn't onChange fire in one particular use case? WPF自定义控件生命周期图? - WPF Custom Control Lifecycle Diagram? 什么更适合我的用例更好的流媒体、长轮询、SSE 或 websocket? - What would suit my use case better streaming, long polling, SSE or websocket? 如何避免一次监听的情况下发生ConcurrentModificationException - how to avoid ConcurrentModificationException for listen once listener case 在视觉继承的情况下,事件处理的标准方法是什么? - What is the standard approach for event handling in case of Visual Inheritance? 为什么jquery .live()在特定情况下有效而on()无效? - Why does jquery .live() works in particular case while on() does not? 在我的情况下,如何获取使用 java 脚本单击了哪个元素 - How to get which element was clicked with java script in my case SAPUI5:如果ODataModel发生变化,如何获取事件通知? - SAPUI5: How to get an event notification in case of ODataModel changes? 如果将JLabel放置在另一个JLabel上,则将mouseClicked事件 - mouseClicked event in a case where a JLabel is placed on top of another JLabel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM