Adapted from Larman “Applying UML and Patterns” Use Case Example - Store system
Use-Case Description Use case: Buy Item Actors: Customer (initiator), Cashier Type: Primary Description:1. The Customer arrives at the checkout with items to purchase. 2. The Cashier records the purchaseitems and collects a payment. 3. On completion theCustomer leaves with the items. Cross Ref.:Requirements XX, YY, and ZZ Pre-conditions: Cashier must have completed the Log In use-case Success-conditions: Customer has the item, Cashier has the money
Use Case Example - Buy Goods CHARACTERISTIC INFORMATION Goal in Context: Buyer issues request directly to our company, expects goods shipped and to be billed. Preconditions: We know Buyer, their address, etc. Success End Condition: Buyer has goods, we have money for the goods. Failed End Condition: We have not sent the goods, Buyer has not spent the money. Primary Actor: Buyer, any agent (or computer) acting for the customer Trigger: purchase request comes in. Buyer Buy Goods Company is out of one of the items Buyer pays directly with credit card Buyer returns goods «extend» Stimuli
Buyer Buy Goods Company is out of one of the items Buyer pays directly with credit card Buyer returns goods «extend» Use Case: 5Buy Goods ---------------------------------------- MAIN SUCCESS SCENARIO 1. Buyer calls in with a purchase request. 2. Company captures buyer’s name, address, requested goods, etc. 3. Company gives buyer information on goods, prices, delivery dates, etc. 4. Buyer signs for order. 5. Company creates order, ships order to buyer. 6. Company ships invoice to buyer. 7. Buyers pays invoice. ---------------------- EXTENSIONS 3a. Company is out of one of the ordered items: 3a1. Renegotiate order. 4a. Buyer pays directly with credit card: 4a1. Take payment by credit card (use case 44) 7a. Buyer returns goods: 7a. Handle returned goods (use case 105) Each step take the form ”A does X”, where A is an actor and X is an action. If a use case is included you will find a step that has the form ”include U”, where U is another use case. Extension 3a is execute instead of 3 if condition: ”Company is out of one of the ordered items” is fulfilled!
More On Use Cases The last step in a extension can take one of the following forms: – Fail - use case is terminated and goal is not achived – Stop - use case is terminated and goal is achived – Resume N - execution should continue at step N in main success scenario. – If the last step is not one of the above, continue at main scenario.
InitiatorReservationMaker GoalReserve room(s) at a hotel Main Success Scenario 1. ReservationMaker asks to make a reservation 2. ReservationMaker selects, in any order, hotel, dates and room type. 3. System provides price to ReservationMaker. 4. ReservationMaker asks for reservation. 5. ReservationMaker provides name, e-mail… 6. System makes reservation and allocates tag to reservation. 7. System reveals tag to ReservationMaker. 8. System creates and sends confirmation by e-mail. Extensions 3. Room not available. a. System offers alternatives. b. ReservationMaker selects from alternatives. 3b. ReservationMaker rejects alternatives. a. Fail 4. ReservationMaker rejects offer a. Fail 5. Customer already on file a. Resume 6 One More Example
Member Services Department Past Member Club Member Request Membership rpts Submit subscription renewal Create new subscription program Submit New Subscription Send subscription renewal offer Send new subscription offer Potential Member Member Services System Submit Regular Order Request Sales Reports Submit Promotion Order Marketing Department Create New Seasonal Promotion Create New Monthly Promotion Request Promotion Reports Send Club Promotion Membership System Orders SubSystem Promotions SubSystem
Guidelines for Developing Use-Case Descriptions Identify the Major Use Cases 1.Find the system’s boundaries 2.List the primary actors 3.List the goals of the primary actors 4.Identify and write the overview of the major use cases for the above 5.Carefully review the current use cases. Revise as needed.
Guidelines for Developing Use-Case Descriptions Expand the Major Use Case 6.Choose one of the use cases to expand 7.Start filling in the details of the chosen use case 8.Write the normal flow of events for the use case 9.If the normal flow of events is too complex or long, decompose into subflows 10.List the possible alternate or exceptional flows 11.For each alternate or exceptional flow, list how the actor and/or the system should react
Guidelines for Developing Use-Case Descriptions Confirm the Major Use Cases 13.Carefully review the current set of use cases. Revise as needed. 14.Start at the top again.
Term Project Submit the Software Requirement Specification (SRS) Document by April 1 st.