Visual Modeling with Rational Rose 2002 and UML
Authors: Quatrani T.
Published year: 2002
Pages: 64-66/134
Buy this book on amazon.com >>
I l @ ve RuBoard

Reflexive Relationships

Multiple objects belonging to the same class may have to communicate with one another. This is shown on the class diagram as a reflexive association or aggregation. Role names rather than association names typically are used for reflexive relationships.

CREATING A REFLEXIVE RELATIONSHIP IN RATIONAL ROSE

graphics/quatranirose_icon.gif
  1. Select the Association (or Aggregation) icon from the toolbar.

  2. Click on the class and drag the association (or aggregation) line outside the class.

  3. Release the mouse button.

  4. Click and drag the association (or aggregation) line back to the class.

  5. Enter the role names and multiplicity for each end of the reflexive association (or aggregation).

A reflexive relationship is shown in Figure 6-8.

Figure 6-8. Reflexive Relationship

graphics/06fig08.jpg

The reflexive relationship in Figure 6-8 may be read in the following ways:

  • One Course object playing the role of Prerequisite is related to zero or more Course objects.

  • One Course object is related to zero or more Course objects playing the role of Prerequisite.

I l @ ve RuBoard
I l @ ve RuBoard

Finding Relationships

Scenarios are examined to determine if a relationship should exist between two classes. Messages between objects mean that the objects must communicate with each other. Associations and/or aggregations provide the pathway for communication.

Relationships may also be discovered based on the signature of an operation. This is discussed in Chapter 7.

Relationships in the ESU Course Registration Problem

In the Add a Course Offering scenario, the communicating objects along with the relationship-type decisions that have been made are shown in Table 6-1.

Table 6-1. Class Relationships
Sending Class Receiving Class Relationship Type
ProfessorCourseOptions AddACourseOffering Aggregation
AddACourseOffering ProfessorCourseManager Association
ProfessorCourseManager Course Association
Course CourseOffering Aggregation

A class diagram with the added relationships is shown in Figure 6-9.

Figure 6-9. Relationships in the Add a Course Offering Scenario

graphics/06fig09.jpg

I l @ ve RuBoard
I l @ ve RuBoard

Package Relationships

Package relationships are also added to the model. The type of relationship is a dependency relationship, shown as a dashed arrow to the dependent package, as shown in Figure 6-10. If package A is dependent on package B this implies that one or more classes in package A initiates communication with one or more public classes in package B. Package A is referred to as the Client package and package B is referred to as the Supplier package. Package relationships are also discovered by examining the scenarios and class relationships for the system under development. As this is an iterative process, the relationships will change as analysis and design progresses.

Figure 6-10. Package Relationships

graphics/06fig10.gif

Package Relationships in the ESU Course Registration Problem

In the Add a Course Offering scenario, the AddACourseOffering class sends a message to the ProfessorCourseManager class. This implies that there is a relationship between the Interfaces package and the UniversityArtifacts package. At this time, we have not discovered any relationships to the People package.

CREATING PACKAGE RELATIONSHIPS IN RATIONAL ROSE

graphics/quatranirose_icon.gif
  1. Select the dependency relationship icon from the toolbar.

  2. Click on the client package and drag the arrow to the supplier package.

The package relationships for the Course Registration System are shown in Figure 6-11.

Figure 6-11. Package Relationships in the ESU Course Registration System

graphics/06fig11.jpg

I l @ ve RuBoard
Visual Modeling with Rational Rose 2002 and UML
Authors: Quatrani T.
Published year: 2002
Pages: 64-66/134
Buy this book on amazon.com >>

Similar books on Amazon