Chapter 13. Organizing Your Model: Packages


As a software program grows in complexity, it can easily contain hundreds of classes. If you're a programmer working with such a class library, how do you make sense of it? One way to impose structure is by organizing your classes into logically related groups. Classes concerned with an application's user interface can belong to one group, and utility classes can belong to another.

In UML, groups of classes are modeled with packages . Most object-oriented languages have an analog of UML packages to organize and avoid name collision among classes. For example, Java has packages, C# has namespaces (although Java packages, and C# namespaces differ significantly in other details). You can use UML packages to model these structures.

Package diagrams are often used to view dependencies among packages. Since a package can break if another package on which it depends changes, understanding dependencies between packages is vital to the stability of your software.

Packages can organize almost any UML elementnot just classes. For example, packages are also commonly used to group use cases. Package diagrams form part of the development view, which is concerned with how your system's parts are organized into modules and packages, as shown in Figure 13-1.

Figure 13-1. The Development View describes how your system's parts are organized into modules, which are represented as packages in UML


Getting Started

Your UML tool probably doesn't have a diagram called a package diagram. Packages are grouping structures that are used to organize almost any UML element, but their most common use is to organize classes in class diagrams. Most of the examples in this chapter focus on applications of packages to classes, so create a new class diagram to work along with these examples.





Learning UML 2.0
Learning UML 2.0
ISBN: 0596009828
EAN: 2147483647
Year: 2007
Pages: 175

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