What is the difference between include
and extend
in a use case diagram?
相关问题
- System sequence diagram - Can system request input
- Does Visual Studio 2010 Professional support UML m
- Can a [GoF]-ConcreteSubject override the notify me
- How to represent enumeration classes with methods
- How to specify “one at a time” in UML?
相关文章
- Code Iris plugin on Android Studio
- Designing a sequence diagram for an auction system
- Game engine design choice [closed]
- state transition with different guard condition
- Resources for learning how to better read code
- What is a use-case? How to identify a use-case? [c
- Relationships in a UML class diagram
- How do you convert a document in UML 1.3 - XMI 1.1
I don't recommend the use of this to remember the two:
My use case: I am going to the city.
includes -> drive the car
extends -> fill the petrol
I would rather you use: My use case: I am going to the city.
extends -> driving the car
includes -> fill the petrol
Am taught that extend relationship continues the behaviour of a base class. The base class functionalities have to be there. The include relationship on the other hand, are akin to functions that may be called. May is in bold.
This can be seen from agilemodeling Reuse in Use-Case Models
I often use this to remember the two:
My use case: I am going to the city.
includes -> drive the car
extends -> fill the petrol
"Fill the petrol" may not be required at all times, but may optionally be required based on the amount of petrol left in the car. "Drive the car" is a prerequisite hence I am including.
Extends is used when you understand that your use case is too much complex. So you extract the complex steps into their own "extension" use cases.
Includes is used when you see common behavior in two use cases. So you abstract out the common behavior into a separate "abstract" use case.
(ref: Jeffrey L. Whitten, Lonnie D. Bentley, Systems analysis & design methods, McGraw-Hill/Irwin, 2007)
Diagram Elements
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.
To simplify,
for
include
a typical example: between login and verify password
(login) --- << include >> ---> (verify password)
for the login process to success, "verify password" must be successful as well.
for
extend
a typical example: between login and show error message (only happened sometimes)
(login) <--- << extend >> --- (show error message)
"show error message" only happens sometimes when the login process failed.
Extend is used when a use case adds steps to another first-class use case.
For example, imagine "Withdraw Cash" is a use case of an Automated Teller Machine (ATM). "Assess Fee" would extend Withdraw Cash and describe the conditional "extension point" that is instantiated when the ATM user doesn't bank at the ATM's owning institution. Notice that the basic "Withdraw Cash" use case stands on its own, without the extension.
Include is used to extract use case fragments that are duplicated in multiple use cases. The included use case cannot stand alone and the original use case is not complete without the included one. This should be used sparingly and only in cases where the duplication is significant and exists by design (rather than by coincidence).
For example, the flow of events that occurs at the beginning of every ATM use case (when the user puts in their ATM card, enters their PIN, and is shown the main menu) would be a good candidate for an include.