Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 3. The Use Case Model > Use Case Diagrams

Use Case Diagrams

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.

Opening a Use Case Diagram

1.
In the Model Explorer, double-click on the diagram.


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

Creating a Use Case Diagram

1.
In the Model Explorer, right-click on the owning package.

2.
Select Add Diagram > Use Case.

3.
This will add a new diagram to the Model Explorer. While the diagram is still selected, enter its name.


Actor–Use Case Relationships

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.

Creating Use Case–Actor Relationships

1.
Double-click on the diagram containing the relationship to open it.

2.
Drag the use case from the Model Explorer onto the diagram.

3.
Select the actor(s) that interact with the use case (Note: to multi-select actors in the Model Explorer, depress the Shift key) and drag them onto the diagram.

4.
Click the Association item in the Palette.

5.
Click on the actor in the diagram and drag the association to 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.

Figure 3-11. Overview Diagram


Figure 3-12. All Use Cases


Figure 3-13. Course Registration Use Cases


Figure 3-14. System Maintenance Use Cases


Relationships Between Use Cases

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.

Creating Include and Extend Relationships

1.
Drag the use cases in the relationship from the Model Explorer onto a diagram.

2.
Select the Include or Extend icon in the Palette. (The last used icon will be visible in the Palette. If that is not the icon that you need, click the arrow next to it to make the other relationship icons visible.)

3.
For an include relationship, click on the base use case and drag the dependency relationship to the included use case.

4.
For an extend relationship, click on the use case with the extended functionality and drag the relationship to the base use case.


Use case relationships are shown in Figure 3-15.

Figure 3-15. Use Case Relationships