在用例图中包含和扩展之间的区别是什么?
当前回答
我认为msdn在这里解释的很容易理解。
包括[5]
包含用例调用或调用包含的用例。包含用于显示用例如何分解为更小的步骤。所包含的用例位于箭头末端。
扩展[6]
同时,扩展用例将目标和步骤添加到扩展用例中。延期只在特定条件下生效。扩展用例位于箭头末端。
其他回答
我认为理解includes和extends的意图很重要:
“包含关系旨在重用已建模的行为 通过另一个用例,而扩展关系是为 向现有的用例中添加部件,以及为可选的系统服务建模”(Overgaard和Palmkvist,用例:模式和蓝图。addison - wesley, 2004)。
在我看来,这是:
包含=功能的重用(即所包含的功能在系统的其他地方被使用或可能被使用)。因此Include表示对另一个用例的依赖。
Extends =添加(而不是重用)功能和任何可选功能。因此,Extends可以表示以下两种情况之一: 1. 向用例中添加新特性/功能(可选或非可选) 2. 任何可选的用例(是否存在)。
简介: 包含=功能的重用 Extends =新的和/或可选的功能
您将经常发现扩展的第二种用法(即可选功能),因为如果功能不是可选的,那么大多数情况下它被内置到用例本身,而不是作为一个扩展。至少这是我的经验。(Julian C指出,当项目进入第二阶段时,你有时会看到扩展的第一次使用(即添加新功能)。
图元素
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>>和<<extend>>根本不应该被使用。
如果你读过Bittner/Spence,你就知道用例是关于综合的,而不是分析的。用例的重用是毫无意义的。它清楚地表明您已经错误地切割了您的域名。附加值本身必须是唯一的。我所知道的唯一附加值再利用方式就是特许经营。如果你是做汉堡生意的,很好。但在其他任何地方,你作为BA的任务是试图找到一个USP。这必须在良好的用例中呈现。
每当我看到人们使用其中一种关系时,都是在尝试进行功能分解的时候。这是完全错误的。
简单地说:如果你可以毫不犹豫地回答你的老板“我做了……”,那么“……”就是你的用例,因为你这样做得到了钱。(这也清楚地表明“登录”根本不是一个用例。)
在这方面,找到包含或扩展其他用例的独立用例是非常不可能的。最终,您可以使用<<extend>>来显示您的系统的可选性,即一些许可模式,它允许包含某些许可的用例或省略它们。但除此之外,就避免他们。
当一个用例有先决条件时,就使用include。
对于有身份验证的用例,最坏的情况,或者是可选的,然后选择extend..
示例:用于寻求入场、预约、机票预订的用例 您必须填写一份表格(注册或反馈表)....这就是包容的由来。
例如:对于验证登录或登录您的帐户的用例,您的身份验证是必须的。还要考虑最坏的情况。比如按时还书,没有预定,逾期付款,这就是延期发挥作用的地方。
不要在图中过度使用include和extend。
保持简单,傻瓜!!
我记得是通过电子游戏。例如, (下面不是100%的用例,只是一个用例的例子)
扩展:主菜单扩展了一些功能,这意味着它们有一些功能,但不需要按下
包括:为了在电子游戏中开火,你必须先有一个武器。