Скачать презентацию CSE 403 Software Requirements and Use Cases Reading Скачать презентацию CSE 403 Software Requirements and Use Cases Reading

22da9fb45fd1a70b9d8bc9d7970cc6b3.ppt

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

CSE 403 Software Requirements and Use Cases Reading: Writing Effective Use Cases A. Cockburn CSE 403 Software Requirements and Use Cases Reading: Writing Effective Use Cases A. Cockburn These lecture slides are copyright (C) Marty Stepp, 2007, with significant content taken from slides written by Valentin Razmov. They may not be rehosted, sold, or modified without expressed permission from the author. All rights reserved. 1

Software requirements n requirements: specify what to build n n tell Software requirements n requirements: specify what to build n n tell "what" and not "how" tell the system design, not the software design tell the problem, not the solution (in detail) Some goals of doing requirements: n n n understand precisely what is required of the software communicate this understanding precisely to all development parties control production to ensure that system meets specs (including changes) 2

Requirements abstraction Requirements abstraction "If a company wishes to let a contract for a large software development project, it must define its needs in a sufficiently abstract way that a solution is not pre-defined. The requirements must be written so that several contractors can bid for the contract, offering, perhaps, different ways of meeting the client organization's needs. Once a contract has been awarded, the contractor must write a system definition for the client in more detail so that the client understands and can validate what the software will do. Both of these documents may be called the requirements document for the system. " 3

F. Brooks quote F. Brooks quote "The hardest single part of building a software system is deciding precisely what to build. No other part of the conceptual work is so difficult as establishing the detailed technical requirements, including all the interfaces to people, to machines, and to other software systems. No other part of the work so cripples the resulting system if done wrong. No other part is more difficult to rectify later. Therefore the most important function that software builders do for their clients is the iterative extraction and refinement of the product requirements. " -- Fred Brooks, The Mythical Man-Month 4

Requirement roles to people n roles of requirements n n n customers: show what Requirement roles to people n roles of requirements n n n customers: show what should be delivered; contractual base managers: a scheduling / progess indicator designers: provide a spec to design coders: list a range of acceptable implementations / output QA / testers: provide a basis for testing, validation, and verification 5

Classifying requirements n A classic way to classify requirements: n n functional: map inputs Classifying requirements n A classic way to classify requirements: n n functional: map inputs to outputs nonfunctional: other constraints n n performance, dependability, reusability, safety Another way to classify them (Faulk) n behavioral: everything about implementation n features, performance, security can be objectively observed / measured development quality attributes: things about internal construction n n flexibility, maintainability, reusability subjective, relative; who says what design is more maintainable? 6

Functional requirements n Examples of functional requirements: n n n The user shall be Functional requirements n Examples of functional requirements: n n n The user shall be able to search either all of the initial set of databases or select a subset from it. The system shall provide appropriate viewers for the user to read documents in the document store. Every order shall be allocated a unique identifier (ORDER_ID) which the user shall be able to copy to the account’s permanent storage area. 7

Non-functional requirements n Examples of non-functional requirements: n n n It shall be possible Non-functional requirements n Examples of non-functional requirements: n n n It shall be possible for all necessary communication between the APSE and the user to be expressed in the standard ASCII character set. The system development process and deliverable documents shall conform to the process and deliverables defined in XYZCo-SP-STAN-95. The system shall not disclose any personal information about customers apart from their name and reference number to the operators of the system. 8

Use cases n use cases: written descriptions of user's interaction with the software product Use cases n use cases: written descriptions of user's interaction with the software product to accomplish a goal n n (in a business system): "A sequence of transactions in a system whose task is to yield a result of measurable value to an individual actor of the business system" (in an information system): "A behaviorally related sequence of transactions performed by an actor in a dialogue with the system to provide some measurable value to the actor" (Jacobson 1995) Use cases are the ways in which a system can be used (the functions which the system provides to its users) Use cases help us discover/document requirements 9

Benefits of doing use cases n The list of goal names provides executives: n Benefits of doing use cases n The list of goal names provides executives: n n n The main success scenario provides all: n n Agreement as to the system’s responsibilities The extension conditions provide programmers: n n n Shortest summary of what system will contribute Project planning skeleton (priorities & timing) List of things programmers have to watch for List of things analysts have to investigate Extension handling steps provide dev team: n A record of (tricky) business policy decisions 10

Cockburn's requirements list Requirements Outline (p 13 -14) - good template of all functional Cockburn's requirements list Requirements Outline (p 13 -14) - good template of all functional requirements 1. purpose and scope 2. terms / glossary 3. use cases 4. technology used 5. other 5 a. development process - participants, values (fast -good-cheap), visibility, competition, dependencies 5 b. business rules / constraints 5 c. performance demands 5 d. security (now a hot topic), documentation 5 e. usability 5 f. portability 5 g. unresolved / deferred 6. human issues: legal, political, organizational, training 11

Actors and stakeholders n What is an actor? A primary actor? n n actor: Actors and stakeholders n What is an actor? A primary actor? n n actor: anything with behavior that acts on the system primary actor: initiates interaction to achieve goal (when system is a software product, primary actor is often the computer user) supporting actor: performs sub-goals to help use case What is the difference between an actor and a stakeholder? n n stakeholder: anyone interested in the system n examples: supplier, stock agency, vendor the difference: stakeholder might not "act" in any scenario 12

Use case goals and levels n n goal: action that actor wants to accomplish Use case goals and levels n n goal: action that actor wants to accomplish level: type / scope of a goal n n n summary goals ("above sea level"): multisitting user goals ("sea-level"): one sitting subfunctions ("below sea level"): partial hy? W ? hat W ? ow H summary goal user goal subfunction 13

Goals and levels, examples n What level are these goals at? n n Withdraw Goals and levels, examples n What level are these goals at? n n Withdraw money from an ATM Purchase a book from the online store, and have it shipped to the user; can be cancelled while in transit Purchase shares of stock online using a "stock trap. " Update user's balance after a deposit. Answers: n user goal, summary goal, subfunction 14

Qualities of a good use case n A good use case: n n n Qualities of a good use case n A good use case: n n n n starts with a request from an actor to the system ends with the production of all the answers to the request defines the interactions (between system and actors) related to the function takes into account the actor's point of view, not the system's focuses on interaction, not internal system activities doesn't describe the GUI in detail has 3 -9 steps in the main success scenario is easy to read 15

Use cases vs. internal features n consider software to run a cell phone: n Use cases vs. internal features n consider software to run a cell phone: n n Use Cases call someone receive a call send a message memorize a number Point of view: user n n Internal Functions transmit / receive data energy (battery) user I/O (display, keys, . . . ) phone-book mgmt. Point of view: developer / designer 16

Do use cases capture these? n Which of these requirements should be represented directly Do use cases capture these? n Which of these requirements should be represented directly in a use case? n n n n Order cost = order item costs * 1. 06 tax. Promotions may not run longer than 6 months. Customers only become Preferred after 1 year. A customer has one and only one sales contact. Response time is less than 2 seconds. Uptime requirement is 99. 8%. Number of simultaneous users will be 200 max. Answer: NONE. Most of these requirements are nonfunctional, so the use cases wouldn't explicitly mention them. The user doesn't see them directly in the success scenario. 17

Styles of use cases Actor / goal list or UML use case diagram 1. Styles of use cases Actor / goal list or UML use case diagram 1. n 2. 3. shows all use cases in system Informal use case Formal use case Let's examine each of these in detail. . . 18

1. Actor / goal list n It can be useful to create a list 1. Actor / goal list n It can be useful to create a list or table of actors and their "goals" (use cases they start): 19

Use case summary diagrams n The overall list of your system's use cases can Use case summary diagrams n The overall list of your system's use cases can be drawn as high-level diagrams, with: n n actors as stick-men, with their names below use cases as ellipses with their names below or inside association indicated by lines, connecting an actor to a use case in which that actor participates use cases can be connected to other cases that they use / rely on open account customer 20

Use case summary diagram 21 Use case summary diagram 21

Use case summary diagram 2 Control System Scan Set limits Experimental Physicist Liaison Physicist Use case summary diagram 2 Control System Scan Set limits Experimental Physicist Liaison Physicist Take profile Calibrate Hardware Specialist 22

Use case summary diagram 3 Customer Applicant Order Food Service Person Hire Employee Reorder Use case summary diagram 3 Customer Applicant Order Food Service Person Hire Employee Reorder supplies <> Supplier Manager <> Track sales and inv. data Produce mgt. reports 23

2. Informal use case n n informal use case: written as a paragraph describing 2. Informal use case n n informal use case: written as a paragraph describing the scenario Example: n Customer Loses a Tape The customer reports to the clerk that he has lost a tape. The clerk prints out the rental record and asks customer to speak with the manager, who will arrange for the customer to pay a fee. The system will be updated to reflect lost tape, and customer's record is updated as well. The manager may authorize purchase of a replacement tape. 24

Formal use case example 25 Formal use case example 25

Formal use case elements (goal of primary actor) (level of goal [summary, user, subfunction]) Formal use case elements (goal of primary actor) (level of goal [summary, user, subfunction]) (primary actor) "Place an order" (User goal / Clerk) (action steps: full sentences showing who takes the action! 3 - 9 steps and quantity. long. ) Main scenario: 1. Clerk identifies customer, item 2. System accepts and queues the order. (condition causing different actions) Extensions: 1 a. Low credit & Customer is 'Preferred': (action step(s) handling those conditions) 1 a 1. System gives them credit anyway. 1 b. Low credit & not 'Preferred' customer: 1 b 1. Clerk performs Sign Up Preferred Customer scenario and accepts only prepayment. (calling another use case) 2 a. Low on stock: Customer accepts rain-check: 2 a 1. Clerk reduces order to available stock level. 26

Example use case Use Case 12. Buy stocks over the web Primary Actor: Purchaser Example use case Use Case 12. Buy stocks over the web Primary Actor: Purchaser (user) Scope: PAF Level: user goal Precondition: User already has PAF open. Guarantees: sufficient log information exists that PAF can detect what went wrong. Success Guarantees: remote web site acknowledged purchase, user's portfolio updated. Main success scenario: 1. User selects to buy stocks over the web. 2. PAF gets name of web site to use (E*Trade, Schwabb, etc. ) 3. PAF opens web connection to the site, retaining control. 4. User browses and buys stock from the web site. 5. PAF intercepts responses from the web site, and updates the user's portfolio. 6. PAF shows the user the new portfolio standing. Extensions: 2 a. User wants a web site PAF does not support: 2 a 1. System gets new suggestion from user, with option to cancel use case. 3 a. . 27

Use case tables n Formal use cases can also be written as a table: Use case tables n Formal use cases can also be written as a table: 28

One method to do use cases Now that we know the syntax for doing One method to do use cases Now that we know the syntax for doing use cases, what 4 steps does Cockburn recommend when actually brainstorming and writing our use cases? 1. identify actors and their goals 2. write the main success scenario 3. identify and list possible failure extensions 4. describe how the system handles each failure Let's look at each step in detail. . . 29

1. Identify actors and goals Ask oneself the following questions: n what computers, subsystems 1. Identify actors and goals Ask oneself the following questions: n what computers, subsystems and people will drive our system? (actors) n n examples: Customer, Clerk, Corporate Mainframe what does each actor need our system to do? n each need may show up as a trigger to a use case result: a list of use cases, a sketch of the system n n short, fairly complete list of usable system function can now draw UML use case diagram for reference 30

Identify actors/goals example n Exercise: Together, let's identify some major actors and their goals Identify actors/goals example n Exercise: Together, let's identify some major actors and their goals for software for a video store kiosk system. n n n The software can be used for looking up movies and actors by keywords, as well as usable to check out movies from the kiosk to known customers, without a cashier present. A customer can check out up to 3 movies at a time, for up to 5 days each. If a movie is returned late, late fees can be paid at the time of return or time of next checkout. 31

2. Write the success scenario n Main success scenario is the preferred 2. Write the success scenario n Main success scenario is the preferred "happy" case n n example: customer=good credit and item=in stock easiest to read and understand everything else is a complication on this Capture each actor's intent and responsibility, from trigger to goal delivery n n say what information passes between them number each line Exercise: Let's do this for the Customer Returns a Movie scenario. 32

3. List the failure extensions n Usually, almost every step can fail n n 3. List the failure extensions n Usually, almost every step can fail n n n example: customer has bad credit example: item is not in stock in desired quantity Note the failure condition separately, after the main success scenario Exercise: Let's do this for the Customer Returns a Movie scenario. 33

4. Describe failure-handling n Recoverable extensions rejoin main course n n n Non-recoverable extensions 4. Describe failure-handling n Recoverable extensions rejoin main course n n n Non-recoverable extensions fail directly n n n example: low credit + valued customer -> accept example: low stock + reduce quantity -> accept not a valued customer -> decline order out of stock -> decline order Each scenario goes from trigger to completion n "extensions" are merely a writing shorthand can write "if" statements can write each scenario from beginning to end Exercise: Let's do this for the Customer Returns a Movie scenario. 34

Pros and cons of use cases pro: n they hold functional requirements in an Pros and cons of use cases pro: n they hold functional requirements in an easy-to -read text format n they make a good framework for non-functional requirements & scheduling con: n they show only the functional reqs n design is not done only in use case units 35

User stories (usage narratives) n n n user story: narrative told from user's perspective, User stories (usage narratives) n n n user story: narrative told from user's perspective, describing his/her usage of the system Example: Bill is a marine biologist who wants to see an article about fish. He selects "Article or journal" from the menu. He chooses topic "fish" from the subsequent list shown. The system returns articles to Bill about his chosen topic. The annotated list designates the physical location of articles. Bill clicks articles of interest to him. Abstracts of each flagged article are displayed. Bill makes a final selection of articles based on abstracts. The abstracts are printed, and Bill retrieves them from the printer. How is this different from an informal use case? n personal; focused on UI; contains non-software details (printing) 36

How do use cases fit in? n How do use cases fit in? n "Hub and spokes" model puts use cases as central to all requirements n n n Adolph's "Discovering" Requirements in New Territory What do you think? use cases help us discover functional requirements in our system and document them n Do use cases affect UI design decisions? 37

Use case exercises n Consider the case of a video store that wants a Use case exercises n Consider the case of a video store that wants a kiosk with intelligent software that can replace human checkout workers. A customer with an account can simply use their membership and credit card with a reader at the kiosk to check out a video. n n Come up with 5 use case names for such software, and draw a UML use case diagram of these cases and their actors. Write a formal (complete) use case for the Customer Checks Out a Movie scenario. 38