UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory UML Weekend Crash Course™ - To Parent Directory

crnarupa.singidunum.ac.rs
from crnarupa.singidunum.ac.rs More from this publisher
01.01.2015 Views

Session 13—Modeling the Static View: The Object Diagram 143 0..* VendorProduct 0..1 Shipment 0..1 CustomProduct Figure 13-4 Initial Class diagram modeling products Figure 13-4 tells you that each Shipment may have zero or more VendorProducts and zero or more CustomProducts. Each type of Product may or may not have been shipped. The rest of this session steps through the construction of an Object diagram that models the set of test cases for the Product Class diagram in Figure 13-4. The construction process demonstrates the model elements of the Object diagram and how the Object diagram illustrates test cases. I’m going to go through this one step at a time. You may spot more problems with the original Class diagram than the current test case reveals. By the time I cover all the test cases, we should have found all the problems. If we don’t, just send me a nice letter with the corrections. Test case 1 A CustomProduct is created by assembling VendorProducts. VendorProducts 28, 38, and 72 create CustomProduct 425. Figure 13-5 shows how the Class diagram is changed to include the aggregation relationship between CustomProduct and VendorProduct. The change shows that a CustomProduct is created from one or more VendorProducts. But a VendorProduct doesn’t have to be used in a CustomProduct. Test case 2 0..* What is the minimum number of objects that make up a CustomProduct configuration After reviewing all the test data, we find that a CustomProduct must consist of at least two VendorProducts. Otherwise, there is no way to distinguish a CustomProduct from a VendorProduct.

144 Saturday Afternoon 28: VendorProduct 4321: Shipment 425: CustomProduct 38: VendorProduct 72: VendorProduct 0..* VendorProduct 0..1 Shipment 0..1 0..* 1..* 0..1 CustomProduct Figure 13-5 The Object diagram (top) for Test Case 1 and the resulting updated Class diagram (bottom) Figure 13-6 shows that the test case revealed the need to alter the minimum multiplicity for VendorProducts used to assemble a CustomProduct from 1 to 2. 4322: Shipment 426: CustomProduct 38: VendorProduct 47: VendorProduct 0..* VendorProduct 0..1 Shipment 0..1 0..* 2..* 0..1 CustomProduct Figure 13-6 The Object diagram (top) and the resulting updated Class diagram (bottom)

144<br />

Saturday Afternoon<br />

28: VendorProduct<br />

4321: Shipment<br />

425: CustomProduct<br />

38: VendorProduct<br />

72: VendorProduct<br />

0..*<br />

VendorProduct<br />

0..1<br />

Shipment<br />

0..1<br />

0..*<br />

1..*<br />

0..1<br />

CustomProduct<br />

Figure 13-5 The Object diagram (top) for Test Case 1 and the resulting updated<br />

Class diagram (bottom)<br />

Figure 13-6 shows that the test case revealed the need to alter the minimum multiplicity<br />

for VendorProducts used to assemble a CustomProduct from 1 to 2.<br />

4322: Shipment<br />

426: CustomProduct<br />

38: VendorProduct<br />

47: VendorProduct<br />

0..*<br />

VendorProduct<br />

0..1<br />

Shipment<br />

0..1<br />

0..*<br />

2..*<br />

0..1<br />

CustomProduct<br />

Figure 13-6 The Object diagram (top) and the resulting updated Class<br />

diagram (bottom)

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

Saved successfully!

Ooh no, something went wrong!