01.01.2015 Views

UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

246<br />

Sunday Morning<br />

<br />

Project A7<br />

Phase 1<br />

role 1<br />

directory<br />

<br />

Receiving<br />

role 2<br />

subsystem<br />

<br />

Order<br />

tracking<br />

role 3<br />

model<br />

Receiving<br />

Order<br />

tracking<br />

Alternative notations<br />

Figure 24-1 Three uses for packages: directories, subsystems, and models<br />

In the second role, the package can represent a subsystem, like the Receiving subsystem<br />

in Figure 24-1. A subsystem is a <strong>UML</strong>-defined stereotype that identifies a cohesive subset of<br />

the total system. For example, the Inventory Control System might be organized into a<br />

Receiving subsystem and a Shipping subsystem, among others.<br />

Elements placed in a subsystem type of package are, by default, visible only within the<br />

package. However, the visibility of individual model elements within the package may be<br />

defined as public, private, or protected. Every subsystem package must have at least one<br />

public interface (that is, at least one class with a public interface).<br />

The third use of packages is called a model. A model is also a <strong>UML</strong>-defined stereotype,<br />

similar to a subsystem in that it contains a cohesive set of elements of the system. The difference<br />

is that the model focuses on a topic or type of behavior within the system. For<br />

example, information about the Order Tracking topic of the third package in Figure 24-1 will<br />

very likely appear in most of the Inventory Control subsystems. Also, because the model is<br />

focused on one topic, it will not contain any system elements that do not help explain the<br />

topic.<br />

Packages Provide a Namespace<br />

All these package types provide a separate namespace for the model elements contained<br />

within them, including other packages. Naming elements within a package requires two<br />

pieces of information: the element name and the element type. For example, a package may<br />

contain something called Product of type Class and something called Product of type<br />

Statechart diagram. Names must be unique across elements of the same type within a package<br />

but do not have to be unique across different types. A package could not contain two<br />

items called Product that are both of type Class.<br />

Model elements in different packages may have the same name. But whenever the two<br />

elements are used together, they must be qualified with the owning package name. A fully<br />

qualified element name uses the notation package :: element, for example Receiving ::<br />

Product and Shipping :: Product.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!