Section 3.1. Representation


3.1. Representation

You show a package using a rectangle with a tab attached to the top left. Figure 3-1 shows the Utilities package.

Figure 3-1. A simple package


You can show the elements contained within a package in two different ways. First, you can show the elements contained within the package by drawing them inside the large rectangle. If you use this representation, write the name of the package in the tab. Figure 3-2 shows the contents of the Utilities package inside of the package. To refer to the Timer class from outside of the Utilities package, you say Utilities::Timer.

Figure 3-2. Several classes contained inside the Utilities package


The second representation uses a solid line pointing from the package to each contained element. You place a circle with a plus sign in it at the end nearest the package to indicate containment. If you use this representation, you should show the name of the package in the large rectangle rather than in the tab. This notation allows you to show more detail of the packaged elements. Figure 3-3 shows the same Utilities package but with the classes broken out.

Figure 3-3. Elements owned by a package, shown outside of the package


You don't need to show all the elements contained within a package; if no elements are shown, no assumptions can be made about what the package contains.




UML 2.0 in a Nutshell
UML 2.0 in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596007957
EAN: 2147483647
Year: 2005
Pages: 132

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