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 17—Applying the Sequence Diagram to the Case Study 183 The system uses this item number to ask Inventory if the product is available in step 10. Inventory replies that it is available (true) in step 11. Since the product is available, the system tells the Order to mark the item “filled”, in step 12, and to return the actual Product in step 13. The system uses the Product to tell Inventory to remove this Product from the Inventory records because it has been allocated to the Order. The Inventory responds saying that the operation succeeded (return true in step 15). :OrderFulfillment Clerk :System :OrdersDB 12345678:Order 23456789:Order :Inventory 1: getOrderNbr():int 2: return 12345678 3: getOrder(ordernbr.int):Order 4: return Order 12345678 5: displayOrder(Order):void 6: getItem():int 7: return item #1 8: getProdSerialNbr(itemnbr:int):int 9: return prodserialnbr 27 10: [item found] getProduct(prodserialnbr:int):boolean 11: return true 12: [product found] fillitem(itemnbr:int):Product 13: return Product 123 14: reduceinv(prod:Product):boolean 15: return true Figure 17-6 Complete the sequence of messages. In Figure 17-6, you can also see the object activations, the narrow vertical rectangles on the timelines. The object activations indicate when each object is busy. Typically the activation begins when a message hits the timeline and ends when the response is sent back. In the case of the system object, the activation runs the entire length showing that the system is overseeing the entire set of interactions. This is sometimes referred to as the focus of control.

184 Saturday Evening For Scenario 2, shown in Figure 17-7, insert a comment referring to steps 1 through 4 of Scenario 1, and then add the new message for Scenario 2. The comment simply helps you avoid having to repeat all the steps you’ve already documented in the previous Sequence diagram. The comment is just a timesaving technique, not a part of the UML or any methodology. The new message in this case is conditional. The condition “order not found” is placed in square brackets [] before the message description. This indicates that the message will only take place if the order is not found in a previous step. :OrderFulfillment Clerk :System :OrdersDB 12345678:Order 23456789:Order :Inventory Repeat steps 1 through 4 of Scenario 1, then 1: displayMsg(chars):void Figure 17-7 Scenario 2 For Scenario 3, shown in Figure 17-8, again insert a comment for the repeated steps, 1 through 9 of Scenario 1. The only difference for this scenario is that it loops back to a previous step. There is no additional processing. If I really fleshed this out I might add the exception handling for items not found. For this course I simply indicate that the process loops back to the test to see if the user is “Done” or there are “no unfilled items” :OrderFulfillment Clerk :System :OrdersDB 12345678:Order 23456789:Order :Inventory Repeat steps 1 through 9 of Scenario 1, then If [item not found] return to the test "Done or no unfilled items" Figure 17-8 Scenario 3 For Scenario 4, in Figure 17-9, continue from step 13 of Scenario 1. This time, the process makes it all the way to the end but there are still unfilled items on the Order. The system tells the Order object to create a backorder in step 1. The Order creates another Order, passing itself as the reference so the backorder can track where it came from (step 2). Note that the minus sign on the operation means that the operation is private (that is, only objects of the same class may invoke it). Step 3 shows that the backorder was successfully created. Step 4 shows the Order telling the System that it finished the task requested in step 1.

184<br />

Saturday Evening<br />

For Scenario 2, shown in Figure 17-7, insert a comment referring to steps 1 through 4 of<br />

Scenario 1, and then add the new message for Scenario 2. The comment simply helps you<br />

avoid having to repeat all the steps you’ve already documented in the previous Sequence diagram.<br />

The comment is just a timesaving technique, not a part of the <strong>UML</strong> or any methodology.<br />

The new message in this case is conditional. The condition “order not found” is placed in<br />

square brackets [] before the message description. This indicates that the message will only<br />

take place if the order is not found in a previous step.<br />

:OrderFulfillment Clerk :System :OrdersDB 12345678:Order 23456789:Order :Inventory<br />

Repeat steps 1 through 4 of Scenario 1, then<br />

1: displayMsg(chars):void<br />

Figure 17-7 Scenario 2<br />

For Scenario 3, shown in Figure 17-8, again insert a comment for the repeated steps,<br />

1 through 9 of Scenario 1. The only difference for this scenario is that it loops back to a<br />

previous step. There is no additional processing. If I really fleshed this out I might add the<br />

exception handling for items not found. For this course I simply indicate that the process<br />

loops back to the test to see if the user is “Done” or there are “no unfilled items”<br />

:OrderFulfillment Clerk :System :OrdersDB 12345678:Order 23456789:Order :Inventory<br />

Repeat steps 1 through 9 of Scenario 1, then<br />

If [item not found] return to the test "Done or no unfilled items"<br />

Figure 17-8 Scenario 3<br />

For Scenario 4, in Figure 17-9, continue from step 13 of Scenario 1. This time, the<br />

process makes it all the way to the end but there are still unfilled items on the Order.<br />

The system tells the Order object to create a backorder in step 1. The Order creates<br />

another Order, passing itself as the reference so the backorder can track where it came from<br />

(step 2). Note that the minus sign on the operation means that the operation is private<br />

(that is, only objects of the same class may invoke it). Step 3 shows that the backorder was<br />

successfully created. Step 4 shows the Order telling the System that it finished the task<br />

requested in step 1.

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

Saved successfully!

Ooh no, something went wrong!