Software Engineering: A Practitioner’s Approach, 6/e Chapter 7 Requirements Engineering Modified to include some Agile Concepts copyright © 1996, 2001, 2005 R.S. Pressman & Associates, Inc. NOTE: Some slides referenced from: Ian Sommerville Slides for Software Engineering. Coming up: What is a requirement? 1 What is a requirement? Requirements are used to describe all aspects of a system They may range from a high-level abstract statement of a service or of a system constraint to a detailed mathematical functional specification They serve many roles May be the basis for a bid for a contract - therefore must be open to interpretation May be the basis for the contract itself - therefore must be defined in detail Are always used to communicate what you intend to build Coming up: Requirements come in many forms 2 Requirements come in many forms Requirements Statements – ex: “The system shall ….” UML Use-case diagrams eXtreme Programming “User Stories” Scrum Product Backlog Any other documents that communicate what you intend to build Prototypes can be used as requirements Existing systems can serve as requirements “Build this system, but use Java instead of Fortran” UML Sequence diagrams, State charts, activity diagrams… Coming up: All Requirements 3 All Requirements Should specify external behavior of the system Includes functional and non-functional requirements Functional requirements are statements of the services that the system must provide What must the system do? Non-functional requirements are constraints on the services and functions offered by the system How must it do it? or a constraint on the system Coming up: Typical Requirements Statements 4 Typical Requirements Statements Functional: The system shall display the heart rate, blood pressure and temperature of a patient connected to the patient monitor. Non-Functional: "Display of the patient's vital signs must respond to a change in the patient's status within 2 seconds.” ‘ilities’ - Performance, Scalability, Capacity, Availability Reliability, Recoverability, Maintainability, Serviceability, Security, Regulatory,Manageability What are some functional requirements on an iPod? Non-functional? Coming up: Why do we care? 5 Why do we care? Most large software systems address wicked problems Problems which are so complex that they can never be fully understood and where understanding develops during the system development Therefore, requirements are normally both incomplete and inconsistent Requirements help by giving you the best understanding you can have at the beginning I’ll destroy you and your little software project to! Coming up: Prescriptive versus Agile approach 6 Prescriptive versus Agile approach Prescriptive – approach is to minimize/prevent change by understanding system thoroughly at the beginning Typically heard: “A change during implementation costs 10 times more than a change during requirements phase” Agile – approach is to manage change by being flexible (i.e. Agile) Typically heard: Requirements planned for 6 months from now are most likely completely inaccurate. Don’t waste resources planning far ahead. Plan short iterations and adjust the plan as you go. Coming up: Typical Prescriptive Requirements Engineering Process 7 Typical Prescriptive Requirements Engineering Process Inception—ask a set of questions that establish … Elicitation—elicit requirements from all stakeholders basic understanding of the problem the people who want a solution the nature of the solution that is desired, and the effectiveness of preliminary communication and collaboration between the customer and the developer to identify the problem propose elements of the solution negotiate different approaches, and specify a preliminary set of solution requirements Elaboration—create an analysis model that identifies data, function and behavioral requirements Negotiation—agree on a deliverable system that is realistic for developers and customers Coming up: Requirements Engineering-II 8 Requirements Engineering-II Specification—can be any one (or more) of the following: Validation—a review mechanism that looks for A written document A set of models A formal mathematical A collection of user scenarios (use-cases) A prototype errors in content or interpretation areas where clarification may be required missing information inconsistencies (a major problem when large products or systems are engineered) conflicting or unrealistic (unachievable) requirements. Requirements management Coming up: Typical Prescriptive Requirements Document Structure 9 Typical Prescriptive Requirements Document Structure Purpose Overall Description System Features (Functional Requirements/Use Cases) External Interface Requirements User interface requirements or standards Hardware interfaces to other systems Software interfaces to other systems Communication Interfaces Non-functional Requirements Appendices - analysis model diagrams See SRS Template (provided by http://www.processimpact.com/ … but essentially from IEEE). Coming up: Inception 10 Elicitation Work Products a statement of need and feasibility. a bounded statement of scope for the system or product. a list of customers, users, and other stakeholders who participated in requirements elicitation a description of the system’s technical environment. a list of requirements (preferably organized by function) and the domain constraints that apply to each. a set of usage scenarios that provide insight into the use of the system or product under different operating conditions. any prototypes developed to better define requirements. Coming up: Analysis Model 14 Analysis Model Included to provide more clarification about textual requirements (where needed) Elements of the analysis model Scenario-based elements Coming up: Use-Cases Functional—processing narratives for software functions Use-case—descriptions of the interaction between an “actor” and the system Class-based elements – e.g. class diagram Behavioral elements – e.g. state diagram, sequence diagram, activity diagram, etc.. Flow-oriented elements – e.g. data flow diagram 15 Use-Cases A collection of user scenarios that describe the thread of usage of a system Each scenario is described from the point-of-view of an “actor”—a person or device that interacts with the software in some way Each scenario answers the following questions: Who is the primary actor, the secondary actor (s)? What are the actor’s goals? What preconditions should exist before the story begins? What main tasks or functions are performed by the actor? What extensions might be considered as the story is described? What variations in the actor’s interaction are possible? What system information will the actor acquire, produce, or change? Will the actor have to inform the system about changes in the external environment? What information does the actor desire from the system? Does the actor wish to be informed about unexpected changes? Coming up: Use-Case Diagram 16 Use-Case Diagram Each stick figure is an actor in your system Arms/ disarms syst em Accesses syst em via Int ernet homeow ner Responds t o alarm event sensors The block is an external system that interacts with your system. Any system you aren’t developing is external Encount ers an error condit ion syst em administ rat or Coming up: Use Case Description Reconf igures sensors and relat ed syst em f eat ures Each oval is a separate use case that has a description 17 Use Case Description Objective - What is the ultimate objective of the use-case. What is it trying to achieve? What was the source of the use-case requirement? Priority – The overall priority of this use-case (Low, Medium, High) Source – Who is the main source of this use case. Who cares most about this functionality? This should be the one person you would ask if there is a question about this use-case. (Make up a name and cite their: John Smith (End-user) here.) Actors - Who is involved in the use-case? Which actors/stakeholders? Flow of Events Basic Flow - flow of events normally executed in the use-case Alternative Flow(s) - a secondary flow of events due to infrequent conditions Exception Flow(s) - Exceptions that may happen during the execution of the use case Includes - other use case IDs that are referenced in steps in the flow of events. Preconditions - Any condition that must be satisfied before the use case begins. If the condition is “User is logged in”, then the first step of the use case is NOT “User logs in”. They are already logged in if that is a precondition! Post conditions - The conditions that will be satisfied after the use case successfully completes Notes/Issues - Any relevant notes or issues that need to be resolved Coming up: Example State Diagram 18 Example State Diagram Reading commands Init ializat ion t urn copier “on“ syst em st at us=“not ready” display msg = “please wait ” display st at us = blinking subsyst ems ready ent ry/ swit ch machine on do: run diagnost ics do: init iat e all subsyst ems not jammed syst em st at us=“Ready” display msg = “ent er cmd” display st at us = st eady paper f ull ent ry/ subsyst ems ready do: poll user input panel do: read user input do: int erpret user input t urn copier “of f ” st art copies Making copies copies complet e syst em st at us=“Copying” display msg= “copy count =” display message=#copies display st at us= st eady ent ry/ st art copies do: manage copying do: monit or paper t ray do: monit or paper f low paper t ray empt y paper jammed problem diagnosis syst em st at us=“Jammed” display msg = “paper jam” display message=locat ion display st at us= blinking load paper syst em st at us=“load paper” display msg= “load paper” display st at us= blinking ent ry/ paper empt y do: lower paper t ray do: monit or f ill swit ch do: raise paper t ray not jammed ent ry/ paper jammed do: det ermine locat ion do: provide correct ivemsg. do: int errupt making copies Figure 7.6 Preliminary UML st at e diagram for a phot ocopier Coming up: eXtreme Programming (XP): User Stories 19 eXtreme Programming (XP): User Stories Serve as requirements within the XP process Written by customers Time Estimated by developers Replaces large requirements documents Represents anything that is “progress” to the customer Examples: Students can purchase monthly parking passes online. Parking passes can be paid via credit cards. Parking passes can be paid via PayPal Professors can input student marks. Students can obtain their current seminar schedule.・Students can order official transcripts. Coming up: eXtreme Programming (XP): User Stories 20 eXtreme Programming (XP): User Stories Short – 1 or 2 sentences. Usually supposed to fit on a 3x5 notecard Easy to estimate (project velocity) Allows requirements to change frequently with less impact Without accompanying validation tests may lead to misinterpretation Difficult to scale to very large projects Require close customer contact to ensure correct implementation Coming up: Format for User Stories (CS421 only… not standard!) 21 Format for User Stories (CS421 only… not standard!) Unique Identifier Source – who should developer contact with questions about this? Story – short (1-3 sentence) high-level description of story. When the developer plans to implement they should discuss with the customer the details. As a [user role], I want to [goal], so I can [reason]. Time estimate – how long in “ideal development time” – time without meetings or any interruptions Client’s Priority – how important is the story to the client? (Low, Medium, High) Coming up: The web has MANY references about User Stories. Here is one if you have more questions 22 The web has MANY references about User Stories. Here is one if you have more questions http://www.agile-softwaredevelopment.com/search/label/user%20stories Coming up: Agile and Traditional Requirements share more than they differ 23 Agile and Traditional Requirements share more than they differ Coming up: Negotiating Requirements 24 Negotiating Requirements Identify the key stakeholders Determine each of the stakeholders’ “win conditions” These are the people who will be involved in the negotiation Win conditions are not always obvious Negotiate Work toward a set of requirements that lead to “win-win” Coming up: Reasons we need to negotiate 25 Reasons we need to negotiate Discuss Large software systems must improve the current situation. It is hard to anticipate the effects that the new system will have on the organization Discuss Prototyping is often required to clarify requirements Negotiate Different users have different requirements and priorities. There is a constantly shifting compromise in the requirements Negotiate System end-users and organizations who pay for the system have different requirements Coming up: Requirements Rationale 26 Requirements Rationale It is important to provide rationale with requirements This helps the developer understand the application domain and why the requirement is stated in its current form Particularly important when requirements have to be changed. The availability of rationale reduces the chances that change will have unexpected effects In this class we’ll provide the requirement’s source and assume they can contact the source to get a rationale if needed instead of an explicit “rationale” Coming up: Non-Functional Requirement Types 27 Non-Functional Requirement Non Functional = Types Remember: How the system Product requirements Requirements which specify that the delivered product must behave in a particular way e.g. execution speed, reliability, etc. Organizational requirements should do something Requirements which are a consequence of organizational policies and procedures e.g. process standards used, implementation requirements, etc. External requirements Requirements which arise from factors which are external to the system and its development process e.g. interoperability requirements, legislative requirements, etc. Coming up: Non-Functional Requirement Examples 28 Non-Functional Requirement Examples Product requirement Organizational requirement 4.C.8 It shall be possible for all necessary communication between the APSE and the user to be expressed in the standard Ada character set. constraint: interoperability 9.3.2 The system development process and deliverable documents shall conform to the process and deliverables defined in XYZCo-SPSTAN-95. constraint: quality External requirement 7.6.5 The system shall provide facilities that allow any user to check if personal data is maintained on the system. A procedure must be defined and supported in the software that will allow users to inspect personal data and to correct any errors in that data. security, maintainability Coming up: Requirements must be testable Agile stories? How? 29 Requirements must be testable Traditional requirements must be written so that they can be objectively verified. XP requirements have explicit acceptance test cases written by the customers to solve this problem. The problem with this requirement is its use of vague terms such as ‘errors shall be minimized” The system should be easy to use by experienced controllers and should be organized in such a way that user errors are minimized. The error rate should be been quantified Experienced controllers should be able to use all the system functions after a total of two hours training. After this training, the average number of errors made by experienced users should not exceed two per day. Coming up: Requirements: testable metrics 30 Requirements: testable metrics Property Speed Size Ease of use Reliability Robustness Portability Coming up: System Level Requirements Measure Processed transactions/second User/Event response time Screen refresh time K Bytes Number of RAM chips Training time Number of help frames Mean time to failure Probability of unavailability Rate of failure occurrence Availability Time to restart after failure Percentage of events causing failure Probability of data corruption on failure Percentage of target dependent statements Number of target systems 31 System Level Requirements Some requirements place constraints on the system as a whole rather than specific system functions Example The time required for training a system operator to be proficient in the use of the system must not exceed 2 working days. These may be emergent requirements which cannot be derived from any single sub-set of the system requirements Coming up: Requirements Validation 32 Requirements Validation Concerned with demonstrating that the requirements define the system that the customer really wants Requirements error costs are high so validation is very important Fixing a requirements error after delivery may cost up to 100 times the cost of fixing an implementation error Prototyping is an important technique of requirements validation Coming up: Validating Requirements-I 33 Validating Requirements-I Is each requirement consistent with the overall objective for the system/product? Work with all parties on this question! Have all requirements been specified at the proper level of abstraction? That is, do some requirements provide a level of technical detail that is inappropriate at this stage? Is the requirement really necessary or does it represent an add-on feature that may not be essential to the objective of the system? Is each requirement bounded and unambiguous? Does each requirement have attribution? That is, is a source (generally, a specific individual) noted for each requirement? Do any requirements conflict with other requirements? Coming up: Validating Requirements-II 34 Validating Requirements-II Is each requirement achievable in the technical environment that will house the system or product? Is each requirement testable, once implemented? Does the requirements model properly reflect the information, function and behavior of the system to be built. Has the requirements model been “partitioned” in a way that exposes progressively more detailed information about the system. Have requirements patterns been used to simplify the requirements model. Have all patterns been properly validated? Are all patterns consistent with customer requirements? Coming up: Requirements Reviews 35 Requirements Reviews Regular reviews should be held while the requirements definition is being formulated Both client and contractor staff should be involved in reviews Reviews may be formal (with completed documents) or informal. Good communications between developers, customers and users can resolve problems at an early stage Coming up: Requirements Reviews Check 36 Requirements Reviews Check Verifiability. Is the requirement realistically testable? Comprehensibility. Is the requirement properly understood? Traceability. Is the origin of the requirement clearly stated? Adaptability. Can the requirement be changed without a large impact on other requirements? Coming up: Requirements final thoughts… 37 Requirements final thoughts… Requirements should specify one and only one thing Requirements should be testable Requirements should specify what YOUR system must do, not what other (external) systems do Requirements and User Stories can only pass or fail, they can’t partially pass. If you want to partially pass a requirement split into two To make this easier, in this class all functional requirements must begin with “The system shall…” Should have a source Coming up: Requirements final thoughts… 38 Requirements final thoughts… Should not be a design choice (this is hard to get right). The system shall store user information including name, DOB, address and SSN. <-- Good! The system shall store user information in an Oracle database including name, DOB, address, SSN. <-- bad Is Oracle really REQUIRED? Hard to say… maybe, but probably not. This is a decision you would make at implementation design time. Question: Does the customer care that you use Oracle? MySQL? Etc.. Maybe someone found some other MUCH BETTER approach storing the data on moon rocks. Again: This is hard to avoid… and I’m not to concerned with it on the SRS, but I want you to be very aware of when you are making design choices instead of required features. Coming up: Requirements must have a unique ID 39 Requirements must have a unique ID Must have a unique ID. When testing you need to reference REQ-1 or REQ-287. Multiple things cannot be labeled REQ-1. Later our test cases will say: This test case validates requirements REQ-1, REQ-27, and REQ-56. Coming up: Bad Example Requirements Statements 40 Bad Example Requirements Statements Bad requirements examples: The system shall validate and accept credit cards and cashier’s checks. High priority. The system shall process all mouse clicks very fast to ensure user’s do not have to wait. The user must have Adobe Acrobat installed. These don’t have a source or unique ID, but what else is wrong? Coming up: Bad Examples 41 Bad Examples The system shall validate and accept credit cards and cashier’s checks. High priority. The system shall process all mouse clicks very fast to ensure user’s do not have to wait. Problem: two requirements instead of one. If the credit card processing works, but the cashier’s check validation does not… is this requirement pass or fail? Has to be fail, but that is misleading. Maybe only credit cards are high priority and cashier’s checks are low priority. Problem: This is not testable. Quantify how fast is acceptable? The user must have Adobe Acrobat installed. Problem: This is not something our system must do. It could be in the constraints/assumptions or maybe operating environment sections, but is not a functional requirement of our system Coming up: The Result of Good Requirements 42 The Result of Good Requirements Your wicked problems shrink into small manageable problems …. almost as if they are melting away! End of presentation I’m melting! 43