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.

200<br />

Saturday Evening<br />

Scenario 5, in Figure 19-11, is the same as steps 1 through 6 of Scenario 1, but the final<br />

condition is different. When no unfilled items remain, the Use Case terminates.<br />

See scenario #1, steps 1 through 6<br />

[no unfilled items remain]<br />

Figure 19-11<br />

Scenario 5: No more items<br />

Mapping the Sequence and Collaboration Diagram<br />

Elements to the Class Diagram<br />

Because the Class diagram is the source for code generation in object-oriented development,<br />

you need to map what you find in the interaction diagrams back to the Class diagram.<br />

Each event becomes an operation on the class of the receiving object. In the classes in<br />

Figure 19-12, you can see each of the events declared as an operation on the receiving<br />

objects.<br />

OrderFulfillmentClerk<br />

+getItemNbr():int<br />

+getOrderNbr():int<br />

+displayOrder(Order):void<br />

+displayMsg(String):void<br />

Order<br />

-Order(order:Order)<br />

+getProdSerialNbr(itemnbr:int):int<br />

+fillItem(itemnbr:int):Product<br />

+backorder():Order<br />

Inventory<br />

OrdersDB<br />

+reduceInv(prod:Product):boolean<br />

+getProduct(prodserialnbr:int):boolean<br />

+getOrder(ordernbr:int):Order<br />

Figure 19-12 Updated class operations<br />

The first event modeled in Figure 19-4 was sent from the System to<br />

OrderFulfillmentClerk. The event name was getOrderNbr(). The operation is assigned to the<br />

OrderFulfillment class, the class of the receiving object.<br />

The return, sequence #2 in Figure 19-4, shows up as the return on the operation signature.<br />

It is important to remember that there is no reference to the return on the sending<br />

class. Any object may invoke the operation getOrderNbr(). Whichever object invokes the<br />

operation at runtime will receive the return. In this scenario, the invoking object in this<br />

case happens to be System.

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

Saved successfully!

Ooh no, something went wrong!