1

I am trying to understand two sequence diagrams that I have found in the SE course at university of Washington. Can you confirm if my understanding is correct ?

Diagram 1: enter image description here

According to my understanding , this sequence diagram describes the dispatch process of orders to either of two distributors. First of all, there will be a dispatch message for certain order (object of order class). After that for each item in this order (loop) , for if the value of this item is more than 1000 we will make the careful distributor (certain object of distributor class) to dispatch this order. In other words , we will send a message or call the dispatch function of the careful object of the distributor class. Else , if the value is less than 1000 , the other distributor "regular" will dispatch this item.

Diagram 2:

enter image description here

I understand that this diagram describes the operation of buying some items from certain storefront. For certain storefront ( object of storefront class , say amazon ) , there will be a loop for each item or stock available at this storefront, every item will be added to a certain object of cart class and this cart object will call a certain inventory object to reserve this item (call reservethisitem method of that belongs to this object). Next , this inventory object will acknowledge the cart object and the cart object will acknowledge the storefront object for adding this item. After that ,the storefront object will send a message for the cart object to make the checkout of these items that are added to the cart from the for loop. Next , this cart object will invoke its processorder function to process the order. Next this "self function " will invoke the confirmOrder method of the storefront object. Next , the storefront will acknowledge this message , meaning that the order has been confirmed and then an acknowledgment will be sent by the cart order to acknowledge the checkout process. Finally , the cart object will invoke the placeItemInOrder function of the inventory object to place the checked out items in order.

Please someone correct me if there is any misunderstanding. Thanks

2

Diagram 1:

Yes, your understanding of the combined fragments is correct:

  • The loop operator ensures repetition. Note that in principle the iteration constraint between (square brackets) should be a boolean
  • The alt operator means a choice, according to the guard expressions.

Diagram 2:

Yes, your understanding is (almost) correct. You have correctly spotted the different kind of messages, including self-messages and return messages.

Some remarks nevertheless:

  • A little detail: the plain arrow heads indicate synchronous messages: the caller wait for the return message. The open arrow heads mean an asynchronous, meaning that the caller will not wait.
  • The object of class StoreFront seems to represent the UI with the end user. So the AddItem is certainly not invoked for all the available articles, but very probably only upon an action from the user (e.g. click on a buy button). This is also why ther's no loop constraint: the loop is ended when the checkout is invoked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.