Packages

I l @ ve RuBoard

If a system contained only a few classes, you could manage them easily. Most systems are composed of many classes, and thus you need a mechanism to group them together for ease of use, maintainability, and reusability. This is where the concept of a package is useful. A package in the logical view of the model is a collection of related packages and/or classes. By grouping classes into packages, we can look at the "higher" level view of the model (i.e., the packages) or we can dig deeper into the model by looking at what is contained by the package.

Each package contains an interface that is realized by its set of public classesthose classes to which classes in other packages talk. The rest of the classes in a package are implementation classesclasses do not communicate with classes in other packages.

If the system is complex, packages may be created early in the Elaboration Phase to facilitate communication. For simpler systems, the classes found early in analysis may be grouped into one packagethe system itself. As analysis and design progress, the concept of a package will be used to group the classes that are needed to carry out the architectural decisions made for the system.

In the UML, packages are represented as folders. A package is shown in Figure 4-7.

CREATING PACKAGES IN THE ROSE BROWSER

graphics/quatranirose_icon.gif
  1. Right-click to select the Logical View in the browser.

  2. Select the New:Package menu choice.

  3. While the package is still selected, enter the name of the package.

Figure 4-7. UML Notation for a Package

graphics/04fig07.gif

A package created via the browser is shown in Figure 4-8.

Figure 4-8. Package Created in the Browser

graphics/04fig08.jpg

As packages are created, classes in the model are relocated .

RELOCATING CLASSES IN THE ROSE BROWSER

graphics/quatranirose_icon.gif
  1. Click to select the class in the browser.

  2. Drag the class to the desired package.

  3. Repeat the steps for each class that is to be relocated.

Relocated classes are shown in Figure 4-9.

Figure 4-9. Relocated Classes

graphics/04fig09.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

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