UML Weekend Crash Course⢠- To Parent Directory
UML Weekend Crash Course⢠- To Parent Directory UML Weekend Crash Course⢠- To Parent Directory
Session 17—Applying the Sequence Diagram to the Case Study 181 Begin by identifying all the participating objects. Each object is placed at the top of the diagram, as in Figure 17-2. The order doesn’t really matter. However, when the diagram is finished, it sometimes helps to move them around to improve the readability of the messages on the diagram. This Use Case includes the Order Fulfillment Clerk, the System itself, the Orders database, two Orders (the primary and the backorder), and the Inventory. :OrderFulfillment Clerk :System :OrdersDB 12345678:Order 23456789:Order :Inventory Figure 17-2 Sequence diagram with objects and timelines The first Sequence diagram models Scenario 1. The first, or primary, scenario should be the successful path. The success path is almost always the most comprehensive. The other scenarios are then just deviations from the main scenario. Each step of the flowchart becomes a message and/or a return on the Sequence diagram (depending on how the step is described). The first step is “Get Order #.” On the Sequence diagram (Figure 17-3) this appears as a procedure call (step 1) and a response (step 2). Note the format of the procedure call (message): Sequence number (optional) A colon Condition (optional) Operation signature, which is made up of: Visibility, (+ means public, - private, # protected) Operation name (getOrderNbr) Arguments () – no arguments for this call A colon Return data type (int – meaning integer value). :OrderFulfillment Clerk :System :OrdersDB 12345678:Order 23456789:Order :Inventory 1: getOrderNbr():int 2: return 12345678 Figure 17-3 Add steps 1 and 2; get the order number
182 Saturday Evening The next step is “getOrder” from the database. In the flowchart, I stated that this was a call to the Find Order Use Case. In order to keep the focus on the Sequence diagram construction, I model it here as a procedure call with a response. In Figure 17-4, steps 3 and 4 show the call and response. :OrderFulfillment Clerk :System :OrdersDB 12345678:Order 23456789:Order :Inventory 1: getOrderNbr():int 2: return12345678 3: getOrder(ordernbr:int):Order 4: return Order 12345678 Figure 17-4 Add steps 3 and 4; get the Order using the order number The return is simply the data (the Order) being sent back as a result of performing the operation. Remember that the Sequence diagram is modeling a test case, so the return should be a value. Sometimes you’ll model a rule, in which case you would show the return data type rather than a specific value. The next step is “display Order.” Because this message does not require a response, Figure 17-5 shows the use of an asynchronous communication using a line-style arrow. There is no corresponding return arrow. :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 Figure 17-5 Add an asynchronous message. The rest of the steps are modeled in Figure 17-6. After the Order is displayed in step 5, the system asks the user for the first item to look up (step 6, getItem():int). The system is expecting to get an integer representing the number of the item on the Order to look up. It gets the reply “item #1” in step 7. The system uses the item number in step 8 to ask the Order for the corresponding product serial number. The Order returns the product serial number in step 9.
- Page 153 and 154: 130 Saturday Afternoon or not. Each
- Page 155 and 156: 132 Saturday Afternoon 5. “Any it
- Page 157 and 158: 134 Saturday Afternoon designed to
- Page 159 and 160: 136 Saturday Afternoon Table 12-3 T
- Page 161 and 162: 138 Saturday Afternoon REVIEW The C
- 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: 180 Saturday Evening Scenario 1 Get
- 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 and 214: 190 Saturday Evening 7:addProduct(c
- Page 215 and 216: 192 Saturday Evening REVIEW The Col
- 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
Session 17—Applying the Sequence Diagram to the Case Study 181<br />
Begin by identifying all the participating objects. Each object is placed at the top of the<br />
diagram, as in Figure 17-2. The order doesn’t really matter. However, when the diagram is<br />
finished, it sometimes helps to move them around to improve the readability of the messages<br />
on the diagram. This Use Case includes the Order Fulfillment Clerk, the System itself, the<br />
Orders database, two Orders (the primary and the backorder), and the Inventory.<br />
:OrderFulfillment Clerk :System :OrdersDB 12345678:Order 23456789:Order :Inventory<br />
Figure 17-2 Sequence diagram with objects and timelines<br />
The first Sequence diagram models Scenario 1. The first, or primary, scenario should be<br />
the successful path. The success path is almost always the most comprehensive. The other<br />
scenarios are then just deviations from the main scenario.<br />
Each step of the flowchart becomes a message and/or a return on the Sequence diagram<br />
(depending on how the step is described). The first step is “Get Order #.” On the Sequence<br />
diagram (Figure 17-3) this appears as a procedure call (step 1) and a response (step 2).<br />
Note the format of the procedure call (message):<br />
Sequence number (optional)<br />
A colon<br />
Condition (optional)<br />
Operation signature, which is made up of:<br />
Visibility, (+ means public, - private, # protected)<br />
Operation name (getOrderNbr)<br />
Arguments () – no arguments for this call<br />
A colon<br />
Return data type (int – meaning integer value).<br />
:OrderFulfillment Clerk :System :OrdersDB 12345678:Order 23456789:Order :Inventory<br />
1: getOrderNbr():int<br />
2: return 12345678<br />
Figure 17-3<br />
Add steps 1 and 2; get the order number