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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Session 13—Modeling the Static View: The Object Diagram 141<br />

Shipment<br />

-date: Date = today<br />

-destination: Address = null<br />

-shipper: Vendor = null<br />

+authorize(empl: Employee)<br />

+seal(empl: Employee)<br />

+ship(shipper: Vendor)<br />

Product<br />

-desc: String = null<br />

delivers<br />

-serialnbr: String = system assigned<br />

-spec_handling: String = null<br />

0..1 1..* +reserve(order: Order)<br />

+stock(loc: Location)<br />

Figure 13-2 <strong>UML</strong> Class notation for the Shipment and Product<br />

The Object diagram in Figure 13-3 shows that the object 4321 of type Shipment has two<br />

Products. Each attribute for the three objects is assigned a value. Note that the special handling<br />

attribute on one Product is blank. This can be a valid value. It is the class definition<br />

for the attribute that determines the valid values that may be assigned to the attribute<br />

when it appears within an object.<br />

4321 : Shipment<br />

-date= 01-27-02<br />

-destination= Portland, OR<br />

-shipper= Billy Bob's Trucking<br />

21 : Product<br />

-desc= CD Player XL 850<br />

-serialnbr= 123456<br />

-spec_handling =<br />

96 : Product<br />

-desc= Speaker Set SS420<br />

-serialnbr= 234567<br />

-spec_handling = fragile<br />

Figure 13-3 <strong>UML</strong> Object notation for a Shipment with two Products<br />

Note what is missing from the object notation that was required in every class. The third<br />

compartment, containing the operations, was omitted. But why leave it out of the object if<br />

the class sets the rules that an object must follow When you included the attributes, it was<br />

because each object potentially possessed different values for the attributes defined by the<br />

class. But the class defines an operation that does not have multiple interpretations or values.<br />

Every object of the same class possesses the same operations. <strong>To</strong> model the operations<br />

again on the Object diagram would add redundancy without adding new information. So you<br />

leave the operations off of the Object diagram.<br />

Having seen examples of the differences between the Class and Object diagrams, you can<br />

now refer to Table 13-1 for a side-by-side comparison of their features. A working knowledge<br />

of the relationship between these two types of diagrams will help you understand how to use<br />

them both to facilitate analysis and test the results of your analysis and design efforts.

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

Saved successfully!

Ooh no, something went wrong!