Class Diagrams

I l @ ve RuBoard

As more and more classes are added to the model, a textual representation of the classes is not sufficient. Class diagrams are created to provide a picture or view of some or all of the classes in the model.

The main class diagram in the logical view of the model is typically a picture of the packages in the system. Each package also has its own main class diagram, which typically displays the "public" classes of the package. Other diagrams are created as needed. Some typical uses of other diagrams are the following:

  • View of all the implementation classes in a package

  • View of the structure and behavior of one or more classes

  • View of an inheritance hierarchy

THE MAIN CLASS DIAGRAM IN RATIONAL ROSE

graphics/quatranirose_icon.gif

Rose automatically creates the Main class diagram in the Logical View of the model.

To add packages to the Main class diagram:

  1. Double-click on the Main diagram in the browser to open the diagram.

  2. Click to select the package in the browser.

  3. Drag the package onto the diagram.

  4. Repeat the preceding steps for each package that is to be added to the diagram.

The Main class diagram for the Registration System is shown in Figure 4-12.

CREATING A PACKAGE MAIN CLASS DIAGRAM IN RATIONAL ROSE

graphics/quatranirose_icon.gif
  1. Double-click on the package on a class diagram.

  2. Rose will "open" the package and create (or display) the main class diagram for the package.

  3. Click to select a class in the browser and drag the class onto the diagram. (Note: The stereotype display of a class may be set using the Format: Stereotype display menu choice.)

  4. Repeat step 3 for each additional class that is to be placed on the diagram.

Figure 4-12. Main Class Diagram

graphics/04fig12.jpg

The main class diagram for the UniversityArtifacts package is shown in Figure 4-13. Notice that the CourseOffering class is not on the diagram. This is an "implementation" class in the package and we decided not to show it on the main diagram of the package. As more packages and classes are added to the model, additional diagrams are created as needed.

TO SET VISIBILITY DISPLAY IN RATIONAL ROSE

graphics/quatranirose_icon.gif

To set the default visibility display:

  1. Select the Tools:Options menu choice.

  2. Select the Diagram tab.

  3. Select the Show Visibility checkbox to set the default to show the visibility of all classes.

Figure 4-13. UniversityArtifacts Package Main Class Diagram

graphics/04fig13.jpg

To set the visibility for a selected class:

  1. Right-click to select the class on a diagram and make the shortcut menu visible.

  2. Click to select or deselect the Options:Show Visibility menu choice.

A class diagram showing package visibility is shown in Figure 4-14.

Figure 4-14. Class Diagram with Package Visibility

graphics/04fig14.jpg

I l @ ve RuBoard


Visual Modeling with Rational Rose 2002 and UML
Visual Modeling with Rational Rose 2002 and UML (3rd Edition)
ISBN: 0201729326
EAN: 2147483647
Year: 2002
Pages: 134

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net