在用例图中包含和扩展之间的区别是什么?
当前回答
我喜欢把“包含”看作基本用例的必要前提/伴随。这意味着如果没有基本用例所包含的用例,就不能认为基本用例是完整的。我将给出一个向客户销售商品的电子商务网站的例子。如果不先选择商品并将其放入购物车,你就无法支付商品。这意味着用例“Pay for Item”包括“select Item”。
扩展的用途多种多样,但我喜欢将其视为一种可能使用也可能不使用的替代方法。例如,仍然在电子商务网站。在付款时,您可以选择货到付款、使用paypal付款或刷卡付款。这些都是“为物品付费”用例的替代方案。我可以根据自己的喜好选择其中任何一种。
想要更清楚地了解用例的规则,请阅读我的文章:
http://businessanalystlearnings.com/ba-techniques/2013/2/20/use-case-diagram-the-basics
其他回答
当您理解您的用例过于复杂时,可以使用Extends。因此,您将复杂的步骤提取到它们自己的“扩展”用例中。
Includes用于在两个用例中看到相同的行为。因此,您将常见的行为抽象到一个单独的“抽象”用例中。
(参考:Jeffrey L. Whitten, Lonnie D. Bentley,系统分析与设计方法,McGraw-Hill/Irwin, 2007)
我认为理解includes和extends的意图很重要:
“包含关系旨在重用已建模的行为 通过另一个用例,而扩展关系是为 向现有的用例中添加部件,以及为可选的系统服务建模”(Overgaard和Palmkvist,用例:模式和蓝图。addison - wesley, 2004)。
在我看来,这是:
包含=功能的重用(即所包含的功能在系统的其他地方被使用或可能被使用)。因此Include表示对另一个用例的依赖。
Extends =添加(而不是重用)功能和任何可选功能。因此,Extends可以表示以下两种情况之一: 1. 向用例中添加新特性/功能(可选或非可选) 2. 任何可选的用例(是否存在)。
简介: 包含=功能的重用 Extends =新的和/或可选的功能
您将经常发现扩展的第二种用法(即可选功能),因为如果功能不是可选的,那么大多数情况下它被内置到用例本身,而不是作为一个扩展。至少这是我的经验。(Julian C指出,当项目进入第二阶段时,你有时会看到扩展的第一次使用(即添加新功能)。
我喜欢把“包含”看作基本用例的必要前提/伴随。这意味着如果没有基本用例所包含的用例,就不能认为基本用例是完整的。我将给出一个向客户销售商品的电子商务网站的例子。如果不先选择商品并将其放入购物车,你就无法支付商品。这意味着用例“Pay for Item”包括“select Item”。
扩展的用途多种多样,但我喜欢将其视为一种可能使用也可能不使用的替代方法。例如,仍然在电子商务网站。在付款时,您可以选择货到付款、使用paypal付款或刷卡付款。这些都是“为物品付费”用例的替代方案。我可以根据自己的喜好选择其中任何一种。
想要更清楚地了解用例的规则,请阅读我的文章:
http://businessanalystlearnings.com/ba-techniques/2013/2/20/use-case-diagram-the-basics
图元素
Actors: Also referred to as Roles. Name and stereotype of an actor can be changed in its Properties tab. Inheritance: Refinement relations between actors. This relation can carry a name and a stereotype. Use cases: These can have Extension Points. Extension Points: This defines a location where an extension can be added. Associations: Between roles and use cases. It is useful to give associations speaking names. Dependencies: Between use cases. Dependencies often have a stereotype to better define the role of the dependency. To select a stereotype, select the dependency from the diagram or the Navigation pane, then change the stereotype in the Properties tab. There are two special kinds of dependencies: <<extend>> and <<include>>, for which Poseidon offers own buttons (see below). Extend relationship: A uni-directional relationship between two use cases. An extend relationship between use case B and use case A means that the behavior of B can be included in A. Include relationship: A uni-directional relationship between two use cases. Such a relationship between use cases A and B means, that the behavior of B is always included in A. System border: The system border is actually not implemented as model element in Poseidon for UML. You can simply draw a rectangle, send it to the background and use it as system border by putting all corresponding use cases inside the rectangle.
这是一个很好的资源,有很好的解释: 用例中包含什么? 什么是扩展用例?
扩展用例通常定义可选的行为。它独立于扩展用例 Include用于提取两个或多个用例的行为的公共部分