Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
A use case diagram is used to visualize the relationships between use cases and actors and between use cases and other use cases. The UML does not specify how many use case diagrams to create—you just create as many as you need to communication the functional requirements of the system (and typically, the more use cases in the system, the more diagrams you will probably create). However, I have found that no matter how many use cases you have, the following use case diagrams are always created:
Main use case diagram showing the functional use case packages
A diagram showing the most important use cases (for smaller systems this diagram may contain all of the use cases; for larger systems this diagram contains the architecturally significant use cases)
A main diagram for each functional area showing the use cases in that functional area
If you used the use case model template, all of these diagrams are created—all you need to do is populate them.
|
You may feel the need to create additional diagrams. This is usually the case if you have a large system with many use cases. Some examples of additional diagrams are:
A diagram showing all of the use cases for a given actor
A diagram showing use cases that are executed in one sequence
Use cases that are being implemented for a particular iteration
Communication between an actor and a use case is shown with an association. This type of association is often referred to as a communicate association. There is only one communicate association between an actor and a use case no matter how many messages pass between the actor and the use case.
|
The use case diagrams for the Course Registration System are shown in Figures 3-11, 3-12, 3-13, and 3-14.
There are two types of relationships that may exist between use cases: include and extend. Multiple use cases may share pieces of the same functionality. This functionality is placed in a separate use case rather than documenting it in every use case that needs it.
Include relationships are created between the new use case and any other use case that “uses” its functionality. For example, each use case in the ESU Course Registration System starts with the verification of the user. This functionality can be captured in a User Verification use case, which is then used by other use cases as needed. An include relationship is drawn as a dependency relationship that points from the base use case to the used use case.
An extend relationship is used to show
Optional behavior
Behavior that is run only under certain conditions, such as triggering an alarm
Several different flows that may be run based on actor selection
For example, if a current selection is not available during the Register for Courses use cases, the student may want to see what other courses are available. Thus, the Browse Course Catalog use case may be an extension of the Register for Courses use case. An extend relationship is drawn as a dependency relationship that points from the extension to the base use case.
The UML has a concept called a stereotype, which provides the capability of extending the basic modeling elements to create new elements. Thus, the concept of a stereotype allows the UML to have a minimal set of symbols that may be extended where needed to provide the communication artifacts that have meaning for the system under development. Stereotype names are included within guillemets (<< >>) and placed along the relationship line. Stereotypes are used to create the needed use case relationships. The stereotype <<communicate>> may be added to an association to show that the association is a communicate association. This is optional since an association is the only type of relationship allowed between an actor and a use case. Include and extend relationships must use stereotypes since they are both represented by a dependency relationship.
|
Use case relationships are shown in Figure 3-15.