UML Weekend Crash Course⢠- To Parent Directory
UML Weekend Crash Course⢠- To Parent Directory UML Weekend Crash Course⢠- To Parent Directory
Session 18—Modeling the Dynamic View: The Collaboration Diagram 191 7. Comment: Reference 7 shows one way that you can reveal your intention to repeat a set of messages. As with Sequence diagrams, comments can be very helpful for explaining your intentions regarding iteration across a set of messages because the iteration notation provided by the UML works only for a single event. Now I’ll change a few items on the diagram so that you can see some new notations. The following descriptions refer to the numbered items in Figure 18-4. 9: Bill: Customer 1 1:Order() 3:addItem(characters) 10:cancel() Bill’s Order : Order 2:return Order 8:return 11:return 5:return product available 7:addProduct(characters) 2 4:productAvailable(characters) 6:[product available] reduceInventory(product #, qty) :Inventory Figure 18-4 More Collaboration diagram notation Note the following items on the diagram: 1. Timeout event: I haven’t labeled this message, mostly because a timeout would be a bit unusual for this type of scenario. This way you get to see the notation anyway. Actually, this is a common extension to the UML (that is, it isn’t explicitly defined by the UML). The small circle represents a clock and sometimes even shows the clock hands within the circle. A timeout would be used for something like dialing into a network or polling a node on a network. If you don’t get a response within a specified amount of time, you abandon the attempt and move on. In this case, if the Order doesn’t respond within the specified time limit, the Order is cancelled in step 10. 2. Asynchronous message: An asynchronous message does not require a reply. Step 6 has been altered to simply tell the Inventory, “I’ve taken some of your stock. You might want to update your records. But I’m not going to wait around until you do.”
192 Saturday Evening REVIEW The Collaboration diagram models pretty much the same information as a Sequence diagram, interactions between objects. It is the perspective that is different. The Collaboration diagram views interactions relative to the structure of the objects and their relationships (links) with one another. The Sequence diagram focuses on timing. Consequently, the advantage of the Collaboration diagram is that it can help you validate the associations between classes or even discover the need for new associations. The Collaboration diagram is built on top of an Object diagram. 1. Place the participating objects on the diagram. 2. Draw the links between the objects using the Class diagram as your guide. 3. Add each event. Place the message arrow parallel to the link between the two objects. Position the arrow to point from the sender to the receiver. 4. Number the messages in order of execution. 5. Repeat steps 3 and 4 until the entire scenario has been modeled. QUIZ YOURSELF 1. How are the participating objects represented in a Collaboration diagram (See “Collaboration Diagram Notation.”) 2. How do you know whether a message may be sent from one particular object to another (See “Diagram differences.”) 3. The Sequence diagram uses a timeline to show the order of messages. What do you use on a Collaboration diagram (See “Collaboration Diagram Notation.”) 4. What is a synchronous message (See “Collaboration Diagram Notation.”) 5. What is an asynchronous message (See “Collaboration Diagram Notation.”)
- Page 163 and 164: 140 Saturday Afternoon Introducing
- Page 165 and 166: 142 Saturday Afternoon Table 13-1 C
- Page 167 and 168: 144 Saturday Afternoon 28: VendorPr
- Page 169 and 170: 146 Saturday Afternoon 0..* VendorP
- Page 172 and 173: SESSION 14 Modeling the Functional
- Page 174 and 175: Session 14—Modeling the Functiona
- Page 176 and 177: Session 14—Modeling the Functiona
- Page 178: Session 14—Modeling the Functiona
- Page 181 and 182: 158 Saturday Afternoon Table 15-1 T
- Page 183 and 184: 160 Saturday Afternoon Figure 15-1
- Page 185 and 186: 162 Saturday Afternoon More product
- Page 187 and 188: 164 Saturday Afternoon start (merge
- Page 190 and 191: SESSION 16 Modeling the Dynamic Vie
- Page 192 and 193: Session 16—Modeling the Dynamic V
- Page 194 and 195: Session 16—Modeling the Dynamic V
- Page 196 and 197: Session 16—Modeling the Dynamic V
- Page 199 and 200: PART III # Saturday Afternoon Part
- Page 201 and 202: PART IV Saturday Evening Session 17
- Page 203 and 204: 180 Saturday Evening Scenario 1 Get
- Page 205 and 206: 182 Saturday Evening The next step
- Page 207 and 208: 184 Saturday Evening For Scenario 2
- Page 209 and 210: 186 Saturday Evening For subsequent
- Page 211 and 212: 188 Saturday Evening 6:addProduct(c
- Page 213: 190 Saturday Evening 7:addProduct(c
- Page 217 and 218: 194 Saturday Evening Scenario 1 Get
- Page 219 and 220: 196 Saturday Evening pointing towar
- Page 221 and 222: 198 Saturday Evening :OrderFullfill
- Page 223 and 224: 200 Saturday Evening Scenario 5, in
- Page 226 and 227: SESSION 20 Modeling the Dynamic Vie
- Page 228 and 229: Session 20—Modeling the Dynamic V
- Page 230 and 231: Session 20—Modeling the Dynamic V
- Page 232 and 233: Session 20—Modeling the Dynamic V
- Page 234: Session 20—Modeling the Dynamic V
- Page 238 and 239: Part V — Sunday Morning Session 2
- Page 240 and 241: SESSION 21 Applying the Basic State
- Page 242 and 243: Session 21—Applying the Basic Sta
- Page 244 and 245: Session 21—Applying the Basic Sta
- Page 246 and 247: Session 21—Applying the Basic Sta
- Page 248: Session 21—Applying the Basic Sta
- Page 251 and 252: 228 Sunday Morning receivePmt(amt)[
- Page 253 and 254: 230 Sunday Morning Figure 22-4 repr
- Page 255 and 256: 232 Sunday Morning A substate is a
- Page 257 and 258: 234 Sunday Morning Monitor when tem
- Page 260 and 261: SESSION 23 Applying the Extended St
- Page 262 and 263: Session 23—Applying the Extended
Session 18—Modeling the Dynamic View: The Collaboration Diagram 191<br />
7. Comment: Reference 7 shows one way that you can reveal your intention to repeat<br />
a set of messages. As with Sequence diagrams, comments can be very helpful for<br />
explaining your intentions regarding iteration across a set of messages because the<br />
iteration notation provided by the <strong>UML</strong> works only for a single event.<br />
Now I’ll change a few items on the diagram so that you can see some new notations. The<br />
following descriptions refer to the numbered items in Figure 18-4.<br />
9:<br />
Bill:<br />
Customer<br />
1<br />
1:Order()<br />
3:addItem(characters)<br />
10:cancel()<br />
Bill’s Order :<br />
Order<br />
2:return Order<br />
8:return<br />
11:return<br />
5:return product available<br />
7:addProduct(characters)<br />
2<br />
4:productAvailable(characters)<br />
6:[product available]<br />
reduceInventory(product #, qty)<br />
:Inventory<br />
Figure 18-4 More Collaboration diagram notation<br />
Note the following items on the diagram:<br />
1. Timeout event: I haven’t labeled this message, mostly because a timeout would be<br />
a bit unusual for this type of scenario. This way you get to see the notation anyway.<br />
Actually, this is a common extension to the <strong>UML</strong> (that is, it isn’t explicitly<br />
defined by the <strong>UML</strong>). The small circle represents a clock and sometimes even shows<br />
the clock hands within the circle. A timeout would be used for something like<br />
dialing into a network or polling a node on a network. If you don’t get a response<br />
within a specified amount of time, you abandon the attempt and move on. In this<br />
case, if the Order doesn’t respond within the specified time limit, the Order is cancelled<br />
in step 10.<br />
2. Asynchronous message: An asynchronous message does not require a reply. Step 6<br />
has been altered to simply tell the Inventory, “I’ve taken some of your stock. You<br />
might want to update your records. But I’m not going to wait around until you do.”