Скачать презентацию Use Cases Chapter 7 Appendix A What Скачать презентацию Use Cases Chapter 7 Appendix A What

7485d0281e6fc3737af629a69e6135d7.ppt

  • Количество слайдов: 24

Use Cases Chapter 7 Appendix A Use Cases Chapter 7 Appendix A

What Are Use Cases? A use case describes a scenario of interactions between a What Are Use Cases? A use case describes a scenario of interactions between a system and a user that results in the user accomplishing some meaningful task or goal. Note: Users are most often persons, but on occasion, they could be another program, hardware – any entity that interacts with the system to achieve some goal. 2

Purpose of Use Cases n n n 3 To describe the tasks users will Purpose of Use Cases n n n 3 To describe the tasks users will need to perform with the system Use cases can capture functional requirements from the user’s perspective Use cases frequently expose user requirements that might otherwise have been forgotten or glossed over

Use Cases as Input for Analysis Draft Functional Req’mts Use Case Descriptions Draft Test Use Cases as Input for Analysis Draft Functional Req’mts Use Case Descriptions Draft Test Cases Draft Analysis Models 4

Use Cases Use case is a depiction of a system’s behavior or functionality under Use Cases Use case is a depiction of a system’s behavior or functionality under various conditions as the system responds to requests from users. n Actor is an external entity that interacts with the system. n Chapter 7 Appendix A © 2011 Pearson Education, Inc. Publishing as Prentice Hall 5

Use Cases (Cont. ) n n n Most actors represent user roles, but actors Use Cases (Cont. ) n n n Most actors represent user roles, but actors can also be external systems. An actor is a role, not a specific user; one user may play many roles, and an actor may represent many users. A use case model consists of actors and use cases. Chapter 7 Appendix A © 2011 Pearson Education, Inc. Publishing as Prentice Hall 6

Written Use Cases Document containing detailed specifications for a use case n Contents can Written Use Cases Document containing detailed specifications for a use case n Contents can be written as simple text or in a specified format n Step-by-step description of what must occur in a successful use case n Chapter 7 Appendix A © 2011 Pearson Education, Inc. Publishing as Prentice Hall 7

Use Case Template – Example Use Case 1: Buy Stocks over the Web (adapted Use Case Template – Example Use Case 1: Buy Stocks over the Web (adapted from Alistair Cockburn, Writing Effective Use Cases, 2001) Primary Actor: Purchaser, employing Personal Advisor Financial (PAF) System Pre-conditions: User already has PAF open and is logged in Post-conditions: Minimal Guarantee : Sufficient information will be logged for PAF to detect errors and ask user for additional information if needed Success Guarantee : Remote Web site acknowledges purchase and the logs and user’s portfolio are updated cont’d 8

Use Case Template – Example (cont’d) Main Success Scenario: 1. Purchaser selects to buy Use Case Template – Example (cont’d) Main Success Scenario: 1. Purchaser selects to buy stocks over Web 2. PAF gets name of web site to use (E*Trade, Schwab, etc. ) from user 3. PAF opens web connection to the site, retaining control 4. Purchaser browses and buys stock from the site 5. PAF gets responses from the web site and updates purchaser’s portfolio 6. PAF shows users the new portfolio Exceptions: 2 a. Purchaser wants a web site that PAF does not support 2 a 1. System gets new suggestion from purchaser, with option to cancel session 3 a. Web site cannot be connected 3 a 1. PAF reports this to purchaser 3 a 2. Purchaser either backs out of session or tries again 4 a. Web site does not acknowledge purchase, but puts it on delay 4 a 1. PAF logs delay, sets timer to ask purchaser about the outcome 5 a. Connection to web site is broken during transmission of response. 5 a 1. PAF notifies purchaser of interruption – then what? ? 9

Practical Hint: Usage Narratives n n n 10 Sometimes it is useful to write Practical Hint: Usage Narratives n n n 10 Sometimes it is useful to write a usage narrative before developing a use case proper These should be a relatively brief overview – not intended to be a finalized requirement The usage narrative is used with customers to get the essential information needed to abstract a more general use case – a kind of use case preliminary

Usage Narrative -- An Example n n 11 Suppose you’ve been asked to work Usage Narrative -- An Example n n 11 Suppose you’ve been asked to work as an analyst on a new system to track pharmacy functions in a hospital. You decide a good first step might be to construct a usage narrative to begin the analysis process. On the next slide is a sample of what such a narrative might be. We will shortly see how to construct a use case from such a narrative.

Example Usage Narrative -- Hospital Pharmacy The Hospital Pharmacy fills prescriptions for the hospital’s Example Usage Narrative -- Hospital Pharmacy The Hospital Pharmacy fills prescriptions for the hospital’s patients and distributes these to the Nurse Station responsible for each patient. The prescription is written by the doctor and sent to the pharmacy where the pharmacist reviews the prescription, checks the patient drug file to determine the appropriateness, such as allergies the patient may have or errors in the prescription (i. e. labor inducement medication prescribed to a male patient). The pharmacist then fills the order if there are no known patient allergies to the drug, and the drug does not interact with other drugs the patient is taking. If the pharmacist decides not to fill the order the doctor is contacted and advised of the problem. The doctor then may decide to have the order filled anyway or the doctor may write another prescription and resubmit it to the pharmacy. Once the prescription is filled a label is generated with the patient information, prescription information and medical information (instructions). The Patient ID and new drug information are entered by the pharmacy into the Patient Drug File. The patient ID number, drug name, amount dispensed and cost of the drug are entered by the pharmacy into the on-line cost center system. The filled Rx is then sent to the appropriate Nurse Station to be administered to the patient. 12

Usage Narrative – Some Questions n n n 13 Where would the information in Usage Narrative – Some Questions n n n 13 Where would the information in the usage narrative come from? How would it be collected? How would it be validated?

Note that not all elements need be present in every use case FIGURE 7 Note that not all elements need be present in every use case FIGURE 7 -29 A template for writing use cases (Source: Writing Effective Use Cases by A. Cockburn, © 2001. Adapted by permission of Pearson Education, Inc. , Upper Saddle River, NJ 07458. ) Chapter 7 Appendix A © 2011 Pearson Education, Inc. Publishing as Prentice Hall 14

Sample Format for Written Use Case n Title – descriptive name, matches name in Sample Format for Written Use Case n Title – descriptive name, matches name in use case diagram n Primary actor – usually a user role n Stakeholders – any group or individual with an interest in the function of the use case Chapter 7 Appendix A © 2011 Pearson Education, Inc. Publishing as Prentice Hall 15

Sample Format for Written Use Case (Continued) n Precondition – conditions that must be Sample Format for Written Use Case (Continued) n Precondition – conditions that must be satisfied in order to execute the use case n Minimal guarantee – outputs that can be expected if the service attempt failed n Success guarantee – outputs that can be expected if the service succeeds Chapter 7 Appendix A © 2011 Pearson Education, Inc. Publishing as Prentice Hall 16

Sample Format for Written Use Case (Continued) n Trigger – an event or action Sample Format for Written Use Case (Continued) n Trigger – an event or action that initiates the use case n Main success scenario – description of sequence of interactions between actor and use case during the use case execution n Extensions – detailed description of how errors are dealt with Chapter 7 Appendix A © 2011 Pearson Education, Inc. Publishing as Prentice Hall 17

Use case at very high level Chapter 7 Appendix A © 2011 Pearson Education, Use case at very high level Chapter 7 Appendix A © 2011 Pearson Education, Inc. Publishing as Prentice Hall 18

Use case at detail level Corresponds with Step 1 of Highlevel use case Chapter Use case at detail level Corresponds with Step 1 of Highlevel use case Chapter 7 Appendix A © 2011 Pearson Education, Inc. Publishing as Prentice Hall 19

From Narrative to Use Case n n 20 Once the usage narrative is written From Narrative to Use Case n n 20 Once the usage narrative is written and validated, it can be used as the foundation for a use case Employing our use case template, the pharmacy usage narrative might produce the following use case.

Another Sample Rx System Use Case (high level): 21 Main Success Scenario 1. Doctor Another Sample Rx System Use Case (high level): 21 Main Success Scenario 1. Doctor enters Rx into system 2. Doctor receives confirmation of Rx accuracy 3. Nurse at nurse station receives label information 4. Patient receives Rx 5. Billing and Patient DBs are updated Exceptions: 1 a. Doctor not authorized for this patient 1 a 1. Rx denied 2 a. System detects allergy conflict 2 a 1. Sends Rx back to doctor 2 b. System detects Rx interaction 2 b 1. Sends Rx back to doctor 3 a. Rx sent to wrong Nurses Station 3 a 1. Nurse sends Rx back to Pharmacy 4 a. Patient status changed 4 a 1. Nurse sends Rx back to Pharmacy 5 a. Patient record unavailable 5 a. 1 ? ?

Putting It Together # 1 Recall the following a prior lecture for a proposed Putting It Together # 1 Recall the following a prior lecture for a proposed new online system to automate seminar registration for a company. Here are the salient features of that proposed system: n Seminar registration is now handled by mail or by phone, based on seminar brochures sent out in the mail. The customer wishes to implement an online (webbased) enrollment system. n A potential seminar enrollee should be able to go to the new web site, select a specific seminar and then pay for and enroll in it if space is available. n Payment would be made by online credit card transaction. The payment information and transaction approval is currently handled by the corporate financial system. n The system should send an email reminder to each paid participant a week before the seminar is scheduled for delivery. n The seminar manager requested an on-demand report showing the current status of enrollment for all seminars being offered. 22

Putting It Together # 1(cont’d) Here’s your task: 1. 2. 3. Review the sample Putting It Together # 1(cont’d) Here’s your task: 1. 2. 3. Review the sample version of the Context DFD – provided on the next slide Work with your team to create a use case from the sample usage narrative given below. Add one or more additional exceptions from the one(s) identified in the given usage narrative. Example Usage Narrative -- Seminar Registration Pre-Conditions: § User has an established account and has logged into that account. (See Use Case # …) § User has completed a catalog search and decided on a seminar. (See Use Case # …) The user will identify and submit the selected course for which they wish to register. If the selected seminar is unavailable, the system will give the user the option of selecting an alternate seminar. If the selected seminar is available, the system will ask the user to confirm the transaction and submit a credit card for charging. If the credit card is valid, it will be charged immediately and the registration will be confirmed. If the card is not valid, the user will be asked to correct the problem. If the 23 problem is not corrected, the transaction will be canceled.

Context. DFD seminar_reminder Attendee Data Store Email Sys seminar_reminder registration_decline attendee_information confirmation_of_cancellation catalog_search_req Seminar Context. DFD seminar_reminder Attendee Data Store Email Sys seminar_reminder registration_decline attendee_information confirmation_of_cancellation catalog_search_req Seminar Attendee registration_req_w_cc cancellation_req confirmation_of_seat payment_info Proposed System credit action Corporate Financial System rep ort_ req rep ort confirmation_of_cc_pmt seminar_information search_results Seminar Data Store Seminar Mgr