【问题标题】:Is my use-case diagram and scenario correct?我的用例图和场景是否正确?
【发布时间】:2014-07-18 00:15:21
【问题描述】:

大家好,我正在学习 UML,我需要有关用例的建议。我正在设计一个会员管理系统。国家管理员可以管理所有(子)组织和用户。我还创建了一个客户管理员,以便客户能够管理其(子)组织的用户。客户管理员无法管理组织,他只能看到他自己的(子)组织及其用户。我画了这个用例图:

我是这样写的:

--- BEGIN ---
Use-case name: Set Up Organization Tree
Description: Allow country admins or customer admins to set up the organization
  structure. Country admins can see or update all members of their country. Customer
  admins can see or update members of their own organization only. 
Actors:
  - Primary actor - Country admin
  - Secondary actor – Customer admin

Basic-flow: Set up an organization structure in the country root
  1) Log in
  2) View organization tree
  3) Create a new organization
  4) Create a new user within the organization
  5) Set the password of the user
  6) 2 to 5 may repeat
  7) Log out

Alternate fow: Set up user accounts within the existing organization
  1) Log in
  2) View organization tree
  3) Create a new user within the selected organization
  4) Set the password of the user
  5) 2 to 5 may repeat
  6) Log out
--- END ---

我不确定它是否正确。可以在基本流程中创建组织,因此它描述了国家/地区管理员可以做什么。在备用流程中,只能创建用户,因此它描述了国家管理员和客户管理员都可以做什么。但是客户管理员只能看到他自己的组织这一事实在这里不可见。此外,我不确定是否可以在单个用例备用流程中全部描述,或者是否应该创建两个单独的用例。一份用于国家/地区管理员,一份用于客户管理员。如果我为国家/地区管理员创建了单独的用例图,我想我不应该在那里提及客户管理员,然后我也不应该绘制客户管理员角色和角色概括? 非常感谢。

Vojtech

编辑 1:

这里是更新版本:

以及更新的场景:

--- BEGIN ---
Use-case name: Create New Customer Organizational Structure
Description: Allow country admin to create new organizational structure of the customer including users. Allow customer admins to create new users within the existing organizational structure. The country admin can see or update all members of the country. The customer admin can see or update users of his/her own organization only.

Actors:
- Country admin
- Customer admin


Basic-flow: Country admin creates new customer organizational structure

Pre-conditions:
- The country admin is logged in
- The customer organizational hierarchy doesn't exists in the Member Manager

Flow of events: Create New customer Organizational Structure 
1) The country admin views the organization tree
2) The country admin creates a new organization
3) The country admin creates a new user within the organization
4) The country admin sets the password of the user
5) 1 to 4 may repeat

Post-condition:
- Customer organizational hierarchy is created
- Customer users are created
- Each user has a password


Alternate fow: Country admin creates new user in the existing organizational structure

Pre-conditions:
- The country admin is logged in
- The country admin can see or edit all members of the country
- The customer organizational hierarchy exists in the Member Manager
- The user that is going to be created doesn't exist

Flow of events:
1) The country admin views organization tree
2) The country admin creates a new user within the selected organization
2) The country admin sets the password of the user
4) 1 to 3 may repeat

Post-condition:
- New users are created in the selected organization
- Each user has a password


Alternate fow: Customer admin creates new user in the existing organizational structure

Pre-conditions:
- The customer admin is logged in
- The customer admin can see or edit members of his own organization only
- The customer organizational hierarchy exists in the Member Manager
- The user that is going to be created doesn't exist

Flow of events;
1) The customer admin views organization tree
2) The customer admin creates a new user within the selected organization
2) The customer admin sets the password of the user
4) 1 to 3 may repeat

Post-condition:
- New users are created in the selected organization
- Each user has a password

--- END ---

在我的场景中现在有两个备用流量:

- Alternate fow: Country admin creates new user in the existing organizational structure
- Alternate fow: Customer admin creates new user in the existing organizational structure

有必要同时提及吗?它们与国家/地区管理员相同,是客户管理员的专业化。 我还提到,客户管理员只能看到他自己组织的成员,而国家/地区管理员可以在场景描述、前提条件和图表注释中看到该国家/地区的所有成员。这是应该的方式吗?

谢谢。沃杰科技

【问题讨论】:

标签: uml use-case


【解决方案1】:

您的图表看起来不错。您的模型读者可以得出结论,两个参与者具有相同的 UC 和 CountryAdmin。特殊规则和限制(如客户管理员只能看到他自己的组织,应单独指定)。

关于流程,它们有几个错误需要修复。我假设您在 UC 标题中弄错了(在描述中,标题是“设置组织树”,在图表中是“创建者组织”)。即使不是这样,大多数错误都是一般性的:

  1. 您似乎将 UC 场景扩展得过多,超出了 UC 的限制。大部分步骤对应其他UC!你不应该在每个 UC 中都有“登录”、“注销”和其他类似的操作,这就是它们被单独定义的原因。因此,您应该只关注 UC 本身的原子操作。
  2. UC 的描述根本不适合场景!在您创建新用户的场景中,标题为“设置组织”。这还不清楚。 UC 标题应该清楚地标明它的目标,这应该通过一个成功的场景来实现。
  3. 应该清楚地指出每个流将在什么条件下被调用。

我建议你解决这个问题并发布新版本的场景。然后我们可以进一步微调它们。

更新(第一次返工后):

你的 UC 必须先完善自己,这样场景编写就会自然而然。您现在错过了一些 UC,而另一些则太大了。

  • 登录和注销必须作为单独的用例存在。登录具有后置条件“用户已登录”。您正确使用了相应的前提条件!
  • 前置条件/​​后置条件适用于整个 UC,而不适用于单个流,以下具体点将进一步说明。
  • 我将打破 2 个 UC 中的主要流程:前 2 个步骤对应于 UC“创建新组织”,而步骤 3-4 可以给 UC“创建用户”。第5步不是必须的
  • 替代流程完全映射在“创建用户”上,您应该稍微改进先决条件。它们总是很常见,但您可以根据用户分为 2 个流程
  • 我会改进前置条件/​​后置条件。您应该保留它们的低数量,因为它们仅表明 UC 是否可以启动。所有其他规则都应该在具体场景中移动。例如“每个用户都有一个密码”有点明显/太详细了,说用户是创建的就足够了。 “将要创建的用户不存在” - 这没有意义,因为在那一刻无法评估。 :)

尝试让 UC 更加具体和封闭。他们应该有一个单一而简单的目标。替代流程应该显示实现目标的不同方式,并且不应该做出不同的事情。所有流程都具有相同的前置条件,并且都应该具有相同的后置条件(当然有错误的除外)。使用 UC 场景中的规则来定义替代流程(例如,主要场景用于“客户管理员”,备用流程用于“国家/地区管理员”。

我建议您再次修改模型并将其发布回来。 :)

【讨论】:

  • 非常感谢您的反馈。我根据您的建议更新了我的图表和场景。您能建议现在应该改进什么吗?我仍然不确定如何正确描述场景中的演员泛化。非常感谢。
  • 好多了,但仍需要一些“结构”改进。请查看答案本身的更新。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-03-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-26
  • 1970-01-01
相关资源
最近更新 更多