3.1. RepresentationYou 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 packageYou 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 packageThe 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 packageYou 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. |