简体   繁体   English

正确指定主要/次要角色(UML用例图)

[英]Specify primary/secondary actors properly (UML Use-Case Diagram)

Consider the following case: 考虑以下情况:

I have a webservice that provides information about orders in an online shop. 我有一个网络服务,提供有关在线商店的订单信息。 On another machine there is a windows service that retrieves orders from the webservice once an hour and writes the data to a database. 在另一台机器上有一个Windows服务,它每小时从Web服务检索一次订单并将数据写入数据库。 Instead of a scheduled task a windows service is used, because it provides a tcp endpoint, so a client can manually (using a simple desktop application) command the service to retrieve data of a specific order. 使用Windows服务而不是计划任务,因为它提供了tcp端点,因此客户端可以手动(使用简单的桌面应用程序)命令服务检索特定订单的数据。

I am unsure where I have to place the windows service. 我不确定我在哪里放置Windows服务。 It is a primary actor calling the webservice in a given interval, but it is a secondary actor as it reacts to the command of a client. 它是在给定时间间隔内调用Web服务的主要角色,但它是次要角色,因为它对客户端的命令作出反应。

How should I proceed creating a Use-Case-Diagram for this scenario? 我该如何为这种情况创建用例图?

The answer depends on what you consider as your system. 答案取决于您认为的系统。

One system 一个系统

If your system contains both the webservice and windows service as parts of your (multi-tiered) system, then neither is an actor. 如果您的系统包含web服务和Windows服务作为(多层)系统的一部分,那么它们都不是演员。 The functionality offered by the windows service will be one (or more, depending on the complexity of the service) use case. Windows服务提供的功能将是一个(或更多,取决于服务的复杂性)用例。 If you assume that webservice it might become a second use case, that is included by the windows service (a rare case but works here). 如果您认为该Web服务可能会成为第二个用例,那么它将包含在Windows服务中(这是一种罕见的情况,但在此处有效)。

The mere fact that those parts are on separate machined doesn't change a thing. 这些零件经过单独加工的事实并没有改变。 It's common approach that database has it's separate machines but no-one reasonable consider it to be separate from the system itself. 数据库拥有独立的机器是常见的方法,但没有人认为它与系统本身是分开的。

Two systems 两个系统

If you treat windows service as a separate system then you will actually have two use case diagrams, one for each of the systems. 如果您将Windows服务视为一个单独的系统,那么您实际上将拥有两个用例图,每个系统一个。

In this case the use case diagram of windows service will have the client as a primary actor and system containing the webservice as a secondary actor. 在这种情况下,Windows服务的用例图将客户端作为主要角色,并将包含web服务的系统作为次要角色。

In the use case diagram of the system with webservice your primary actor would be the windows service system (again as a whole , not a service itself). 在具有webservice的系统的用例图中,您的主要参与者将是Windows服务系统(再次作为整体,而不是服务本身)。 In this diagram the client is not depicted at all as it does not interact with the system. 在此图中,客户端根本没有描绘,因为它不与系统交互。

Component as a system 组件作为系统

Even if you consider both windows service and webservice as a single system, you may still depict use cases of components rather than the system as a whole. 即使您将Windows服务和Web服务都视为单个系统,您仍然可以描述组件的使用情况而不是整个系统。 In such case the aproach will be similar to the situation with two systems. 在这种情况下,aproach将类似于两个系统的情况。

In addition to what @Ister said: Draw a boundary that represents your system under consideration. 除了@Ister所说的:画出代表你所考虑的系统的边界。 Now think about what is inside (the use case bubbles) and what is outside (the actors). 现在想想里面是什么(用例泡泡)和什么是外面的(演员)。 For the latter there's the convention to place the primary actors to the left and the secondary ones to the right. 对于后者,有一个惯例是将主要演员放在左边,将次要演员放在右边。 Primary actors are usually considered the ones that start a workflow while the secondary ones are being triggered/informed in the course of any such workflow. 主要参与者通常被认为是启动工作流程的人员,而次要参与者在任何此类工作流程中被触发/通知。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM