Part II Requirements Engineering Part II provides a

  • Slides: 144
Download presentation
Part II Requirements Engineering Part II provides a detailed study of the engineering of

Part II Requirements Engineering Part II provides a detailed study of the engineering of Requirements Analysis. In addition to the material from R. Pressman, we will use material from the book: “Software Engineering” by Ian Somerville, 6 th Ed. , 2001, Addison-Wesley. Requirements engineering is a fundamental component of the project work and as such it requires as much of a wide view as possible. California State University, Fall 2007, Part II 1

Chapter 7 Requirements Engineering California State University, Fall 2007, Part II 2

Chapter 7 Requirements Engineering California State University, Fall 2007, Part II 2

Software Requirements n Descriptions and specifications of a system California State University, Fall 2007,

Software Requirements n Descriptions and specifications of a system California State University, Fall 2007, Part II 3

Requirements engineering n n The process of establishing the services that the customer requires

Requirements engineering n n The process of establishing the services that the customer requires from a system and the constraints under which it operates and is developed The requirements themselves are the descriptions of the system services and constraints that are generated during the requirements engineering process California State University, Fall 2007, Part II 4

What is a requirement? n n It may range from a high-level abstract statement

What is a requirement? n n It may range from a high-level abstract statement of a service or of a system constraint to a detailed mathematical functional specification This is inevitable as requirements may serve a dual function n 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 Both these statements may be called requirements California State University, Fall 2007, Part II 5

Requirements abstraction (Davis) California State University, Fall 2007, Part II 6

Requirements abstraction (Davis) California State University, Fall 2007, Part II 6

Types of requirement n User requirements n n System requirements n n Statements in

Types of requirement n User requirements n n System requirements n n Statements in natural language plus diagrams of the services the system provides and its operational constraints. Written for customers A structured document setting out detailed descriptions of the system services. Written as a contract between client and contractor Software specification n A detailed software description which can serve as a basis for a design or implementation. Written for developers California State University, Fall 2007, Part II 7

Definitions and specifications SIS California State University, Fall 2007, Part II 8

Definitions and specifications SIS California State University, Fall 2007, Part II 8

Definitions and specifications What’s the meaning of the question marks below? Requirements definition 1.

Definitions and specifications What’s the meaning of the question marks below? Requirements definition 1. The software must (? ) provide a means of representing and accessing external files created by other tools. Requirements specification 1. 1 The user should (? ) be provided with facilities to define the type of external files 1. 2 Each external file may (? ) have an associated tool which may (? ) be applied to the file. 1. 3 Each external file type may (? ) be represented as a specific icon on the user’s display. 1. 4 Facilities should (? ) be provided for the icon representing an external file type to be defined by the user. 1. 5 When a user selects an icon representing an external file, the effect on that selection is (? ) to apply the tool associated with the type of external file to the file represented by the selected icon. What is a SIS? , Software Interface Specification California State University, Fall 2007, Part II 9

Requirements readers California State University, Fall 2007, Part II 10

Requirements readers California State University, Fall 2007, Part II 10

Functional and non-functional requirements n Functional requirements n n Non-functional requirements n n Statements

Functional and non-functional requirements n Functional requirements n n Non-functional requirements n n Statements of services the system should provide, how the system should react to particular inputs and how the system should behave in particular situations. constraints on the services or functions offered by the system such as timing constraints, constraints on the development process, standards, etc. Domain requirements n Requirements that come from the application domain of the system and that reflect characteristics of that domain. California State University, Fall 2007, Part II 11

Functional requirements n n n Describe functionality or system services Depend on the type

Functional requirements n n n Describe functionality or system services Depend on the type of software, expected users and the type of system where the software is used Functional user requirements may be high-level statements of what the system should do but functional system requirements should describe the system services in detail California State University, Fall 2007, Part II 12

Examples of functional requirements n The user shall be able to search either all

Examples of functional requirements n The user shall be able to search either all of the initial set of databases or select a subset from it. n The system shall provide appropriate viewers for the user to read documents in the document store. n 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. California State University, Fall 2007, Part II 13

Requirements imprecision n Problems arise when requirements are not precisely stated Ambiguous requirements may

Requirements imprecision n Problems arise when requirements are not precisely stated Ambiguous requirements may be interpreted in different ways by developers and users Consider the term ‘appropriate viewers’ n n User intention - special purpose viewer for each different document type Developer interpretation - Provide a text viewer that shows the contents of the document California State University, Fall 2007, Part II 14

Requirements completeness and consistency n n In principle requirements should be both complete and

Requirements completeness and consistency n n In principle requirements should be both complete and consistent Complete n n Consistent n n They should include descriptions of all facilities required There should be no conflicts or contradictions in the descriptions of the system facilities In practice, it is impossible to produce a complete and consistent requirements document California State University, Fall 2007, Part II 15

Non-functional requirements n n n Define system properties and constraints e. g. reliability, response

Non-functional requirements n n n Define system properties and constraints e. g. reliability, response time and storage requirements. Constraints are I/O device capability, system representations, etc. Process requirements may also be specified mandating a particular CASE system, programming language or development method Non-functional requirements may be more critical than functional requirements. If these are not met, the system is useless California State University, Fall 2007, Part II 16

Non-functional classifications n Product requirements n n Organizational requirements n n Requirements which specify

Non-functional classifications n Product requirements n n Organizational requirements n n Requirements which specify that the delivered product must behave in a particular way e. g. execution speed, reliability, etc. Requirements which are a consequence of organizational policies and procedures e. g. process standards used, implementation requirements, etc. External requirements n Requirements which arise from factors which are external to the system and its development process e. g. interoperability requirements, legislative requirements, etc. California State University, Fall 2007, Part II 17

Non-functional requirement types California State University, Fall 2007, Part II 18

Non-functional requirement types California State University, Fall 2007, Part II 18

Non-functional requirements examples n Product requirement n n Organisational requirement n n 4. C.

Non-functional requirements examples n Product requirement n n Organisational requirement n n 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 9. 3. 2 The system development process and deliverable documents shall conform to the process and deliverables defined in XYZCo-SPSTAN-95 External requirement n 7. 6. 5 The system shall not disclose any personal information about customers apart from their name and reference number to the operators of the system California State University, Fall 2007, Part II 19

Goals and requirements n n Non-functional requirements may be very difficult to state precisely

Goals and requirements n n Non-functional requirements may be very difficult to state precisely and imprecise requirements may be difficult to verify. Goal n n Verifiable non-functional requirement n n A general intention of the user such as ease of use A statement using some measure that can be objectively tested Goals are helpful to developers as they convey the intentions of the system users California State University, Fall 2007, Part II 20

Examples n A system goal n n The system should be easy to use

Examples n A system goal n n The system should be easy to use by experienced controllers and should be organised in such a way that user errors are minimised. A verifiable non-functional requirement n Experienced controllers shall 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 shall not exceed two per day. California State University, Fall 2007, Part II 21

Requirements measures Property Speed Size Ease of use Reliability Robustness Portability California State University,

Requirements measures Property Speed Size Ease of use Reliability Robustness Portability California State University, Fall 2007, Part II 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 (MTTF) 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 22

Requirements interaction n n Conflicts between different non-functional requirements are common in complex systems

Requirements interaction n n Conflicts between different non-functional requirements are common in complex systems Spacecraft system n n n To minimize weight, the number of separate chips in the system should be minimized To minimize power consumption, lower power chips should be used However, using low power chips may mean that more chips have to be used. Which is the most critical requirement? California State University, Fall 2007, Part II 23

Domain requirements n n n Derived from the application domain and describe system characteristics

Domain requirements n n n Derived from the application domain and describe system characteristics and features that reflect the domain May be new functional requirements, constraints on existing requirements or define specific computations If domain requirements are not satisfied, the system may be unworkable California State University, Fall 2007, Part II 24

Library system domain requirements n There shall be a standard user interface to all

Library system domain requirements n There shall be a standard user interface to all databases which shall be based on the Z 39. 50 standard. n Because of copyright restrictions, some documents must be deleted immediately on arrival. Depending on the user’s requirements, these documents will either be printed locally on the system server for manually forwarding to the user or routed to a network printer. California State University, Fall 2007, Part II 25

Train protection system n The deceleration of the train shall be computed as: n

Train protection system n The deceleration of the train shall be computed as: n Dtrain = Dcontrol + Dgradient where Dgradient is 9. 81 ms 2 * compensated gradient/alpha and where the values of 9. 81 ms 2 /alpha are known for different types of train. California State University, Fall 2007, Part II 26

Domain requirements problems n Understandability n n n Requirements are expressed in the language

Domain requirements problems n Understandability n n n Requirements are expressed in the language of the application domain This is often not understood by software engineers developing the system Implicitness n Domain specialists understand the area so well that they do not think of making the domain requirements explicit California State University, Fall 2007, Part II 27

User requirements n n Should describe functional and non-functional requirements so that they are

User requirements n n Should describe functional and non-functional requirements so that they are understandable by system users who don’t have detailed technical knowledge User requirements are defined using natural language, tables and diagrams California State University, Fall 2007, Part II 28

Problems with natural language (NL) n Lack of clarity n n Requirements confusion n

Problems with natural language (NL) n Lack of clarity n n Requirements confusion n n Precision is difficult without making the document difficult to read Functional and non-functional requirements tend to be mixed-up Requirements amalgamation n Several different requirements may be expressed together California State University, Fall 2007, Part II 29

Database requirement 4. A. 5 The database shall support the generation and control of

Database requirement 4. A. 5 The database shall support the generation and control of configuration objects; that is, objects which are themselves groupings of other objects in the database. The configuration control facilities shall allow access to the objects in a version group by the use of an incomplete name. California State University, Fall 2007, Part II 30

Editor grid requirement 2. 6 Grid facilities To assist in the positioning of entities

Editor grid requirement 2. 6 Grid facilities To assist in the positioning of entities on a diagram, the user may turn on a grid in either centimetres or inches, via an option on the control panel. Initially, the grid is off. The grid may be turned on and off at any time during an editing session and can be toggled between inches and centimetres at any time. A grid option will be provided on the reduce-to-fit view but the number of grid lines shown will be reduced to avoid filling the smaller diagram with grid lines. California State University, Fall 2007, Part II 31

Requirement problems n Database requirements includes both conceptual and detailed information n Describes the

Requirement problems n Database requirements includes both conceptual and detailed information n Describes the concept of configuration control facilities Includes the detail that objects may be accessed using an incomplete name Grid requirement mixes three different kinds of requirement n n n Conceptual functional requirement (the need for a grid) Non-functional requirement (grid units) Non-functional UI requirement (grid switching) California State University, Fall 2007, Part II 32

Structured presentation 2. 6 Grid Facilities 2. 6. 1 The editor shall provide a

Structured presentation 2. 6 Grid Facilities 2. 6. 1 The editor shall provide a grid facility where a matrix of horizontal and vertical lines provide a background to the editor window. This grid shall be a passive grid where the alignment of entities is the user’s responsibility. Rationale: A grid helps the user to create a tidy diagram with wellspaced entities. Although an active grid, where the entities “snap-to” grid lines can be useful, the positioning is imprecise. The user is the best person to decide where entities should be positioned. Specification: ECLIPSE/WS/Tools/DE/DF Section 5. 6 California State University, Fall 2007, Part II 33

Detailed user requirement California State University, Fall 2007, Part II 34

Detailed user requirement California State University, Fall 2007, Part II 34

Detailed user requirement 3. 5. 1 Adding nodes to a design 3. 5. 1.

Detailed user requirement 3. 5. 1 Adding nodes to a design 3. 5. 1. 1 The editor shall provide a facility for users to add nodes of a specified type to their design. 3. 5. 1. 2 The sequence of actions to add a node should be as follows: 1. The user should select the type of node to be added. 2. The user should move the cursor to the approximate node position in the diagram and indicate that the node symbol should be added at that point. 3. The user should then drag the node symbol to its final position. Rationale: The user is the best person to decide where to position a node on the diagram. This approach gives the user direct control over a node type selection and positioning. Specification: ECLIPSE/WS/Tools/DE/FS Section 3. 5. 1 California State University, Fall 2007, Part II 35

Guidelines for writing requirements n n Invent a standard format and use it for

Guidelines for writing requirements n n Invent a standard format and use it for all requirements Use language in a consistent way. Use shall for mandatory requirements, should for desirable requirements (desirements) Use text highlighting to identify key parts of the requirement Avoid the use of computer jargon California State University, Fall 2007, Part II 36

System requirements n n More detailed specifications of user requirements Serve as a basis

System requirements n n More detailed specifications of user requirements Serve as a basis for designing the system May be used as part of the system contract System requirements may be expressed using system models discussed in Chapter 7 (of Somerville’s text). California State University, Fall 2007, Part II 37

Requirements and design n n In principle, requirements should state what the system should

Requirements and design n n In principle, requirements should state what the system should do and the design should describe how it does this In practice, requirements and design are inseparable n n n A system architecture may be designed to structure the requirements The system may inter-operate with other systems that generate design requirements The use of a specific design may be a domain requirement California State University, Fall 2007, Part II 38

Problems with NL (natural language) specification n Ambiguity n n Over-flexibility n n The

Problems with NL (natural language) specification n Ambiguity n n Over-flexibility n n The readers and writers of the requirement must interpret the same words in the same way. NL is naturally ambiguous so this is very difficult The same thing may be said in a number of different ways in the specification Lack of modularization n NL structures are inadequate to structure system requirements California State University, Fall 2007, Part II 39

Alternatives to NL specification Notation Structured natural l anguage Design description l anguages Graphical

Alternatives to NL specification Notation Structured natural l anguage Design description l anguages Graphical notations Mathematical specifications California State University, Fall 2007, Part II Description This a pproach depends on defining standard forms or templates to express the requirements specification. This a pproach uses a la nguage like a programming language but with more abstract features to specify the requirements by defining an operational model of the system. A graphical l anguage, supplemented by text annotations is used to define the functional requirements for the system. An early example of such a graphical language was SADT (Ross , 1977; Schoman and Ross, 1977). More recently, usecase descriptions (Jacobsen, Christerson et al. , 1993) have been used. I discuss these in the following chapter. These are notations based on mathematica l concepts such as finite-state machines or sets. The se unambiguous specifications reduce the arguments between customer and contractor about system functionality. However, most customers don’t understand formal specifications and are reluctant to accept it as a system contract. I discuss formal specification in Chapter 9. 40

Structured language specifications n n n A limited form of natural language may be

Structured language specifications n n n A limited form of natural language may be used to express requirements This removes some of the problems resulting from ambiguity and flexibility and imposes a degree of uniformity on a specification Often best supported using a forms-based approach California State University, Fall 2007, Part II 41

Form-based specifications n n n Definition of the function or entity Description of inputs

Form-based specifications n n n Definition of the function or entity Description of inputs and where they come from Description of outputs and where they go to Indication of other entities required Pre and post conditions (if appropriate) The side effects (if any) California State University, Fall 2007, Part II 42

Form-based node specification ECLIPSE/Workstation/Tools/DE/FS/3. 5. 1 Function Add node Description Adds a node to

Form-based node specification ECLIPSE/Workstation/Tools/DE/FS/3. 5. 1 Function Add node Description Adds a node to an existing design. The user selects the type of node, and its position. When added to the design, the node becomes the current selection. The user chooses the node position by moving the cursor to the area where the node is added. Inputs Node type, Node position, Design identifier. Source Node type and Node position are input by the user, Design identifier from the database. Outputs Design identifier. Destination operation. The Requires design database. The design is committed to the database on completion of the Design graph rooted at input design identifier. Pre-condition The design is open and displayed on the user's screen. Post-condition at the given position. The design is unchanged apart from the addition of a node of the specified type Side-effects None Definition: ECLIPSE/Workstation/Tools/DE/RD/3. 5. 1 California State University, Fall 2007, Part II 43

Program Description Language, PDL, -based requirements definition n n Requirements may be defined operationally

Program Description Language, PDL, -based requirements definition n n Requirements may be defined operationally using a language like a programming language but with more flexibility of expression Most appropriate in two situations n n n Where an operation is specified as a sequence of actions and the order is important When hardware and software interfaces have to be specified Disadvantages are n n The PDL may not be sufficiently expressive to define domain concepts The specification will be taken as a design rather than a specification California State University, Fall 2007, Part II 44

Part of an ATM specification class ATM { // declarations here public static void

Part of an ATM specification class ATM { // declarations here public static void main (String args[]) throws Invalid. Card { try { this. Card. read () ; // may throw Invalid. Card exception pin = Key. Pad. read. Pin () ; attempts = 1 ; while ( !this. Card. pin. equals (pin) & attempts < 4 ) { pin = Key. Pad. read. Pin () ; attempts = attempts + 1; } if (!this. Card. pin. equals (pin)) throw new Invalid. Card ("Bad PIN"); this. Balance = this. Card. get. Balance () ; do { Screen. prompt (" Please select a service ") ; service = Screen. touch. Key () ; switch (service) { case Services. withdrawal. With. Receipt: receipt. Required = true ; California State University, Fall 2007, Part II 45

PDL disadvantages n n n PDL may not be sufficiently expressive to express the

PDL disadvantages n n n PDL may not be sufficiently expressive to express the system functionality in an understandable way Notation is only understandable to people with programming language knowledge The requirement may be taken as a design specification rather than a model to help understand the system California State University, Fall 2007, Part II 46

Interface specification n n Most systems must operate with other systems and the operating

Interface specification n n Most systems must operate with other systems and the operating interfaces must be specified as part of the requirements (SISs = software interface specification) Three types of interface may have to be defined n n Procedural interfaces Data structures that are exchanged Data representations Formal notations are an effective technique for interface specification California State University, Fall 2007, Part II 47

PDL interface description interface Print. Server { // defines an abstract printer server //

PDL interface description interface Print. Server { // defines an abstract printer server // requires: interface Printer, interface Print. Doc // provides: initialize, print, display. Print. Queue, cancel. Print. Job, switch. Printer void initialize ( Printer p ) ; void print ( Printer p, Print. Doc d ) ; void display. Print. Queue ( Printer p ) ; void cancel. Print. Job (Printer p, Print. Doc d) ; void switch. Printer (Printer p 1, Printer p 2, Print. Doc d) ; } //Print. Server California State University, Fall 2007, Part II 48

The requirements document n n n The requirements document is the official statement of

The requirements document n n n The requirements document is the official statement of what is required of the system developers Should include both a definition and a specification of requirements It is NOT a design document. As far as possible, it should set of WHAT the system should do rather than HOW it should do it California State University, Fall 2007, Part II 49

Users of a requirements document California State University, Fall 2007, Part II 50

Users of a requirements document California State University, Fall 2007, Part II 50

Software Requirements document (SRD) n n n Specify external system behaviour Specify implementation constraints

Software Requirements document (SRD) n n n Specify external system behaviour Specify implementation constraints Easy to change Serve as reference tool for maintenance Record forethought about the life cycle of the system i. e. predict changes Characterize responses to unexpected events SRD = Software Requirements Document California State University, Fall 2007, Part II 51

IEEE requirements standard n n n Introduction General description Specific requirements Appendices Index This

IEEE requirements standard n n n Introduction General description Specific requirements Appendices Index This is a generic structure that must be instantiated for specific systems California State University, Fall 2007, Part II 52

Requirements document structure n n n n n Introduction Glossary User requirements definition System

Requirements document structure n n n n n Introduction Glossary User requirements definition System architecture System requirements specification System models System evolution Appendices Index California State University, Fall 2007, Part II 53

Requirements Engineering-I n n Inception—ask a set of questions that establish … n basic

Requirements Engineering-I n n Inception—ask a set of questions that establish … n basic understanding of the problem n the people who want a solution n the nature of the solution that is desired, and n the effectiveness of preliminary communication and collaboration between the customer and the developer Elicitation—elicit requirements from all stakeholders 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 California State University, Fall 2007, Part II 54

Requirements Engineering-II n n n Specification—can be any one (or more) of the following:

Requirements Engineering-II n n n Specification—can be any one (or more) of the following: n A written document n A set of models n A formal mathematical n A collection of user scenarios (use-cases) n A prototype Validation—a review mechanism that looks for n errors in content or interpretation n areas where clarification may be required n missing information n inconsistencies (a major problem when large products or systems are engineered) n conflicting or unrealistic (unachievable) requirements. Requirements management California State University, Fall 2007, Part II 55

Inception n Identify stakeholders n n “who else do you think I should talk

Inception n Identify stakeholders n n “who else do you think I should talk to? ” Recognize multiple points of view Work toward collaboration The first questions n n Who is behind the request for this work? Who will use the solution? What will be the economic benefit of a successful solution Is there another source for the solution that you need? California State University, Fall 2007, Part II 56

“HIRING” Requirements in the Software world n Communications skills. n Ability to work in

“HIRING” Requirements in the Software world n Communications skills. n Ability to work in teams. California State University, Fall 2007, Part II 57

Eliciting Requirements n n n meetings are conducted and attended by both software engineers

Eliciting Requirements n n n meetings are conducted and attended by both software engineers and customers rules for preparation and participation are established an agenda is suggested a "facilitator" (can be a customer, a developer, or an outsider) controls the meeting a "definition mechanism" (can be work sheets, flip charts, or wall stickers or an electronic bulletin board, chat room or virtual forum) is used the goal is n to identify the problem n propose elements of the solution n negotiate different approaches, and n specify a preliminary set of solution requirements California State University, Fall 2007, Part II 58

Eliciting Requirements California State University, Fall 2007, Part II 59

Eliciting Requirements California State University, Fall 2007, Part II 59

Quality Function Deployment n n Function deployment determines the “value” (as perceived by the

Quality Function Deployment n n Function deployment determines the “value” (as perceived by the customer) of each function required of the system Information deployment identifies data objects and events Task deployment examines the behavior of the system Value analysis determines the relative priority of requirements California State University, Fall 2007, Part II 60

Elicitation Work Products n n n n a statement of need and feasibility. a

Elicitation Work Products n n n n 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 California State University, Fall 2007, Part II 61

Use-Cases n n n A collection of user scenarios that describe thread of usage

Use-Cases n n n A collection of user scenarios that describe 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: n n n n n 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? California State University, Fall 2007, Part II 62

Use-Case Diagram California State University, Fall 2007, Part II 63

Use-Case Diagram California State University, Fall 2007, Part II 63

Building the Analysis Model n Elements of the analysis model n Scenario-based elements n

Building the Analysis Model n Elements of the analysis model n Scenario-based elements n n n Class-based elements n n Implied by scenarios Behavioral elements n n Functional—processing narratives for software functions Use-case—descriptions of the interaction between an “actor” and the system State diagram Flow-oriented elements n Data flow diagram California State University, Fall 2007, Part II 64

Class Diagram From the Safe. Home system … California State University, Fall 2007, Part

Class Diagram From the Safe. Home system … California State University, Fall 2007, Part II 65

State Diagram California State University, Fall 2007, Part II 66

State Diagram California State University, Fall 2007, Part II 66

Analysis Pattern name: A descriptor that captures the essence of the pattern. Intent: Describes

Analysis Pattern name: A descriptor that captures the essence of the pattern. Intent: Describes what the pattern accomplishes or represents Motivation: A scenario that illustrates how the pattern can be used to address the problem. Forces and context: A description of external issues (forces) that can affect how the pattern is used and also the external issues that will be resolved when the pattern is applied. Solution: A description of how the pattern is applied to solve the problem with an emphasis on structural and behavioral issues. Consequences: Addresses what happens when the pattern is applied and what tradeoffs exist during its application. Design: Discusses how the analysis pattern can be achieved through the use of known design patterns. Known uses: Examples of uses within actual systems. Related patterns: On e or more analysis patterns that are related to the named pattern because (1) it is commonly used with the named pattern; (2) it is structurally similar to the named pattern; (3) it is a variation of the named pattern. California State University, Fall 2007, Part II 67

Negotiating Requirements n Identify the key stakeholders n n Determine each of the stakeholders

Negotiating Requirements n Identify the key stakeholders n n Determine each of the stakeholders “win conditions” n n These are the people who will be involved in the negotiation Win conditions are not always obvious Negotiate n Work toward a set of requirements that lead to “win-win” California State University, Fall 2007, Part II 68

Validating Requirements-I n n n Is each requirement consistent with the overall objective for

Validating Requirements-I n n n Is each requirement consistent with the overall objective for the system/product? 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? California State University, Fall 2007, Part II 69

Validating Requirements-II n n n Is each requirement achievable in the technical environment that

Validating Requirements-II n n n 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? California State University, Fall 2007, Part II 70

Chapter 8 Analysis Modeling California State University, Fall 2007, Part II 71

Chapter 8 Analysis Modeling California State University, Fall 2007, Part II 71

Requirements Analysis n Requirements analysis n n specifies software’s operational characteristics indicates software's interface

Requirements Analysis n Requirements analysis n n specifies software’s operational characteristics indicates software's interface with other system elements establishes constraints that software must meet Requirements analysis allows the software engineer (called an analyst or modeler in this role) to: n n elaborate on basic requirements established during earlier requirement engineering tasks build models that depict user scenarios, functional activities, problem classes and their relationships, system and class behavior, and the flow of data as it is transformed. California State University, Fall 2007, Part II 72

A Bridge California State University, Fall 2007, Part II 73

A Bridge California State University, Fall 2007, Part II 73

Rules of Thumb n n n The model should focus on requirements that are

Rules of Thumb n n n The model should focus on requirements that are visible within the problem or business domain. The level of abstraction should be relatively high. Each element of the analysis model should add to an overall understanding of software requirements and provide insight into the information domain, function and behavior of the system. Delay consideration of infrastructure and other non-functional models until design. Minimize coupling throughout the system. Be certain that the analysis model provides value to all stakeholders. Keep the model as simple as it can be. California State University, Fall 2007, Part II 74

Domain Analysis Software domain analysis is the identification, analysis, and specification of common requirements

Domain Analysis Software domain analysis is the identification, analysis, and specification of common requirements from a specific application domain, typically for reuse on multiple projects within that application domain. . . [Object-oriented domain analysis is] the identification, analysis, and specification of common, reusable capabilities within a specific application domain, in terms of common objects, classes, subassemblies, and frameworks. . . Donald Firesmith California State University, Fall 2007, Part II 75

Domain Analysis n n Define the domain to be investigated. Collect a representative sample

Domain Analysis n n Define the domain to be investigated. Collect a representative sample of applications in the domain. Analyze each application in the sample. Develop an analysis model for the objects. California State University, Fall 2007, Part II 76

Data Modeling n n examines data objects independently of processing focuses attention on the

Data Modeling n n examines data objects independently of processing focuses attention on the data domain creates a model at the customer’s level of abstraction indicates how data objects relate to one another California State University, Fall 2007, Part II 77

What is a Data Object? Object —something that is described by a set of

What is a Data Object? Object —something that is described by a set of attributes (data items) and that will be manipulated within the software (system) each instance of an object (e. g. , a book) can be identified uniquely (e. g. , ISBN #) each plays a necessary role in the system i. e. , the system could not function without access to instances of the object each is described by attributes that are themselves data items California State University, Fall 2007, Part II 78

Typical Objects external entities (printer, user, sensor) things (e. g, reports, displays, signals) occurrences

Typical Objects external entities (printer, user, sensor) things (e. g, reports, displays, signals) occurrences or events (e. g. , interrupt, alarm) roles (e. g. , manager, engineer, salesperson) (e. g. , division, team) organizational units places (e. g. , manufacturing floor) structures (e. g. , employee record) California State University, Fall 2007, Part II 79

Data Objects and Attributes A data object contains a set of attributes that act

Data Objects and Attributes A data object contains a set of attributes that act as an aspect, quality, characteristic, or descriptor of the object: automobile attributes: make model body type price options code California State University, Fall 2007, Part II 80

What is a Relationship? relationship —indicates “connectedness”; a "fact" that must be "remembered" by

What is a Relationship? relationship —indicates “connectedness”; a "fact" that must be "remembered" by the system and cannot or is not computed or derived mechanically n n several instances of a relationship can exist objects can be related in many different ways California State University, Fall 2007, Part II 81

Entity-Relationship Diagram (ERD) Notation attribute One common form: object 1 (0, m) relationship (1,

Entity-Relationship Diagram (ERD) Notation attribute One common form: object 1 (0, m) relationship (1, 1) object 2 Another common form: object 1 California State University, Fall 2007, Part II relationship (0, m) (1, 1) object 2 82

Building an ERD n n n Level 1—model all data objects (entities) and their

Building an ERD n n n Level 1—model all data objects (entities) and their “connections” to one another Level 2—model all entities and relationships Level 3—model all entities, relationships, and the attributes that provide further depth California State University, Fall 2007, Part II 83

The ERD: An Example Customer (1, 1) places (1, m) request for service (1,

The ERD: An Example Customer (1, 1) places (1, m) request for service (1, 1) standard task table (1, 1) selected from generates work (1, w) tasks materials California State University, Fall 2007, Part II (1, w) (1, i) (1, n) work order (1, 1) (i, 1) (1, 1) consists of lists 84

Object-Oriented Concepts n n Must be understood to apply class-based elements of the analysis

Object-Oriented Concepts n n Must be understood to apply class-based elements of the analysis model Key concepts: n n Classes and objects Attributes and operations Encapsulation and instantiation Inheritance California State University, Fall 2007, Part II 85

Classes • object-oriented thinking begins with the definition of a class, often defined as:

Classes • object-oriented thinking begins with the definition of a class, often defined as: – – – • • template generalized description “blueprint”. . . describing a collection of similar items a metaclass (also called a superclass) establishes a hierarchy of classes once a class of items is defined, a specific instance of the class can be identified California State University, Fall 2007, Part II 86

Building a Class California State University, Fall 2007, Part II 87

Building a Class California State University, Fall 2007, Part II 87

What is a Class? occurrences things roles organizational units places structures external entities class

What is a Class? occurrences things roles organizational units places structures external entities class name attributes: operations: California State University, Fall 2007, Part II 88

Encapsulation/Hiding The object encapsulates both data and the logical procedures required to manipulate the

Encapsulation/Hiding The object encapsulates both data and the logical procedures required to manipulate the data method #2 #1 data method #3 method #6 method #5 method #4 Achieves “information hiding” California State University, Fall 2007, Part II 89

Class Hierarchy Piece. Of. Furniture (superclass) Table Chair Desk ”Chable" subclasses of the instances

Class Hierarchy Piece. Of. Furniture (superclass) Table Chair Desk ”Chable" subclasses of the instances of Chair California State University, Fall 2007, Part II 90

Methods (a. k. a. Operations, Services) An executable procedure that is encapsulated in a

Methods (a. k. a. Operations, Services) An executable procedure that is encapsulated in a class and is designed to operate on one or more data attributes that are defined as part of the class. A method is invoked via message passing. California State University, Fall 2007, Part II 91

Scenario-Based Modeling “[Use-cases] are simply an aid to defining what exists outside the system

Scenario-Based Modeling “[Use-cases] are simply an aid to defining what exists outside the system (actors) and what should be performed by the system (use-cases). ” Ivar Jacobson (1) What should we write about? (2) How much should we write about it? (3) How detailed should we make our description? (4) How should we organize the description? California State University, Fall 2007, Part II 92

Use-Cases n n n a scenario that describes a “thread of usage” for a

Use-Cases n n n a scenario that describes a “thread of usage” for a system actors represent roles people or devices play as the system functions users can play a number of different roles for a given scenario California State University, Fall 2007, Part II 93

Developing a Use-Case n n n What are the main tasks or functions that

Developing a Use-Case n n n What are the main tasks or functions that are performed by the actor? 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? California State University, Fall 2007, Part II 94

Use-Case Diagram California State University, Fall 2007, Part II 95

Use-Case Diagram California State University, Fall 2007, Part II 95

Activity Diagram Supplements the use-case by providing a diagrammatic representation of procedural flow California

Activity Diagram Supplements the use-case by providing a diagrammatic representation of procedural flow California State University, Fall 2007, Part II 96

Swimlane Diagrams Allows the modeler to represent the flow of activities described by the

Swimlane Diagrams Allows the modeler to represent the flow of activities described by the use-case and at the same time indicate which actor (if there are multiple actors involved in a specific use-case) or analysis class has responsibility for the action described by an activity rectangle California State University, Fall 2007, Part II 97

Flow-Oriented Modeling Represents how data objects are transformed at they move through the system

Flow-Oriented Modeling Represents how data objects are transformed at they move through the system A data flow diagram (DFD) is the diagrammatic form that is used Considered by many to be an ‘old school’ approach, floworiented modeling continues to provide a view of the system that is unique—it should be used to supplement other analysis model elements California State University, Fall 2007, Part II 98

The Flow Model Every computer-based system is an information transform. . input California State

The Flow Model Every computer-based system is an information transform. . input California State University, Fall 2007, Part II computer based system output 99

Flow Modeling Notation external entity process data flow data store California State University, Fall

Flow Modeling Notation external entity process data flow data store California State University, Fall 2007, Part II 100

External Entity A producer or consumer of data Examples: a person, a device, a

External Entity A producer or consumer of data Examples: a person, a device, a sensor Another example: computer-based system Data must always originate somewhere and must always be sent to something California State University, Fall 2007, Part II 101

Process A data transformer (changes input to output) Examples: compute taxes, determine area, format

Process A data transformer (changes input to output) Examples: compute taxes, determine area, format report, display graph Data must always be processed in some way to achieve system function California State University, Fall 2007, Part II 102

Data Flow Data flows through a system, beginning as input and be transformed into

Data Flow Data flows through a system, beginning as input and be transformed into output. base height California State University, Fall 2007, Part II compute triangle area 103

Data Stores Data is often stored for later use. sensor # report required look-up

Data Stores Data is often stored for later use. sensor # report required look-up sensor data sensor number sensor #, type, location, age sensor data California State University, Fall 2007, Part II 104

Data Flow Diagramming: Guidelines n n n all icons must be labeled with meaningful

Data Flow Diagramming: Guidelines n n n all icons must be labeled with meaningful names the DFD evolves through a number of levels of detail always begin with a context level diagram (also called level 0) always show external entities at level 0 always label data flow arrows do not represent procedural logic California State University, Fall 2007, Part II 105

Constructing a DFD—I n n n review the data model to isolate data objects

Constructing a DFD—I n n n review the data model to isolate data objects and use a grammatical parse to determine “operations” determine external entities (producers and consumers of data) create a level 0 DFD California State University, Fall 2007, Part II 106

Level 0 DFD Example user video source California State University, Fall 2007, Part II

Level 0 DFD Example user video source California State University, Fall 2007, Part II processing request digital video processor requested video signal monitor NTSC video signal 107

Constructing a DFD—II n n n write a narrative describing the transform parse to

Constructing a DFD—II n n n write a narrative describing the transform parse to determine next level transforms “balance” the flow to maintain data flow continuity develop a level 1 DFD use a 1: 5 (approx. ) expansion ratio California State University, Fall 2007, Part II 108

The Data Flow Hierarchy x a p 1 a c d level 1 California

The Data Flow Hierarchy x a p 1 a c d level 1 California State University, Fall 2007, Part II b P p 2 level 0 f p 4 p 3 y e g p 5 b 109

Flow Modeling Notes n n each bubble is refined until it does just one

Flow Modeling Notes n n each bubble is refined until it does just one thing the expansion ratio decreases as the number of levels increase most systems require between 3 and 7 levels for an adequate flow model a single data flow item (arrow) may be expanded as levels increase (data dictionary provides information) California State University, Fall 2007, Part II 110

Process Specification (PSPEC) bubble PSPEC narrative pseudocode (PDL) equations tables diagrams and/or charts California

Process Specification (PSPEC) bubble PSPEC narrative pseudocode (PDL) equations tables diagrams and/or charts California State University, Fall 2007, Part II 111

DFDs: A Look Ahead analysis model Maps into design model California State University, Fall

DFDs: A Look Ahead analysis model Maps into design model California State University, Fall 2007, Part II 112

Control Flow Diagrams n n Represent “events” and the processes that manage events An

Control Flow Diagrams n n Represent “events” and the processes that manage events An “event” is a Boolean condition that can be ascertained by: n n n listing all sensors that are "read" by the software. listing all interrupt conditions. listing all "switches" that are actuated by an operator. listing all data conditions. recalling the noun/verb parse that was applied to the processing narrative, review all "control items" as possible CSPEC inputs/outputs. California State University, Fall 2007, Part II 113

The Control Model the control flow diagram is "superimposed" on the DFD and shows

The Control Model the control flow diagram is "superimposed" on the DFD and shows events that control the processes noted in the DFD control flows—events and control items—are noted by dashed arrows a vertical bar implies an input to or output from a control spec (CSPEC) — a separate specification that describes how control is handled a dashed arrow entering a vertical bar is an input to the CSPEC a dashed arrow leaving a process implies a data condition a dashed arrow entering a process implies a control input read directly by the process control flows do not physically activate/deactivate the processes—this is done via the CSPEC California State University, Fall 2007, Part II 114

Control Flow Diagram beeper on/off read operator input empty jammed copies done full manage

Control Flow Diagram beeper on/off read operator input empty jammed copies done full manage copying problem light start reload process perform problem diagnosis create user displays display panel enabled California State University, Fall 2007, Part II 115

Control Specification (CSPEC) The CSPEC can be: state diagram (sequential spec) state transition table

Control Specification (CSPEC) The CSPEC can be: state diagram (sequential spec) state transition table combinatorial spec decision tables activation tables California State University, Fall 2007, Part II 116

Guidelines for Building a CSPEC list all sensors that are "read" by the software

Guidelines for Building a CSPEC list all sensors that are "read" by the software list all interrupt conditions list all "switches" that are actuated by the operator list all data conditions recalling the noun-verb parse that was applied to the software statement of scope, review all "control items" as possible CSPEC inputs/outputs describe the behavior of a system by identifying its states; identify how each state is reach and defines the transitions between states focus on possible omissions. . . a very common error in specifying control, e. g. , ask: "Is there any other way I can get to this state or exit from it? " California State University, Fall 2007, Part II 117

Class-Based Modeling n n Identify analysis classes by examining the problem statement Use a

Class-Based Modeling n n Identify analysis classes by examining the problem statement Use a “grammatical parse” to isolate potential classes Identify the attributes of each class Identify operations that manipulate the attributes California State University, Fall 2007, Part II 118

Analysis Classes n n n n External entities (e. g. , other systems, devices,

Analysis Classes n n n n External entities (e. g. , other systems, devices, people) that produce or consume information to be used by a computer-based system. Things (e. g, reports, displays, letters, signals) that are part of the information domain for the problem. Occurrences or events (e. g. , a property transfer or the completion of a series of robot movements) that occur within the context of system operation. Roles (e. g. , manager, engineer, salesperson) played by people who interact with the system. Organizational units (e. g. , division, group, team) that are relevant to an application. Places (e. g. , manufacturing floor or loading dock) that establish the context of the problem and the overall function of the system. Structures (e. g. , sensors, four-wheeled vehicles, or computers) that define a class of objects or related classes of objects. California State University, Fall 2007, Part II 119

Selecting Classes—Criteria retained information needed services multiple attributes common operations essential requirements California State

Selecting Classes—Criteria retained information needed services multiple attributes common operations essential requirements California State University, Fall 2007, Part II 120

Class name Class Diagram attributes operations California State University, Fall 2007, Part II 121

Class name Class Diagram attributes operations California State University, Fall 2007, Part II 121

Class Diagram California State University, Fall 2007, Part II 122

Class Diagram California State University, Fall 2007, Part II 122

CRC (Class-Responsibility-Collaborator) Modeling n Analysis classes have “responsibilities” n n Responsibilities are the attributes

CRC (Class-Responsibility-Collaborator) Modeling n Analysis classes have “responsibilities” n n Responsibilities are the attributes and operations encapsulated by the class Analysis classes collaborate with one another n n Collaborators are those classes that are required to provide a class with the information needed to complete a responsibility. In general, a collaboration implies either a request for information or a request for some action. California State University, Fall 2007, Part II 123

CRC Modeling California State University, Fall 2007, Part II 124

CRC Modeling California State University, Fall 2007, Part II 124

Class Types n Entity classes, also called model or business classes, are extracted directly

Class Types n Entity classes, also called model or business classes, are extracted directly from the statement of the problem (e. g. , Floor. Plan and Sensor). n Boundary classes are used to create the interface (e. g. , interactive screen or printed reports) that the user sees and interacts with as the software is used. Controller classes manage a “unit of work” [UML 03] from start to finish. That is, controller classes can be designed to manage n n n the creation or update of entity objects; the instantiation of boundary objects as they obtain information from entity objects; complex communication between sets of objects; validation of data communicated between objects or between the user and the application. California State University, Fall 2007, Part II 125

Responsibilities n n n System intelligence should be distributed across classes to best address

Responsibilities n n n System intelligence should be distributed across classes to best address the needs of the problem Each responsibility should be stated as generally as possible Information and the behavior related to it should reside within the same class Information about one thing should be localized with a single class, not distributed across multiple classes. Responsibilities should be shared among related classes, when appropriate. California State University, Fall 2007, Part II 126

Collaborations n Classes fulfill their responsibilities in one of two ways: n n n

Collaborations n Classes fulfill their responsibilities in one of two ways: n n n A class can use its own operations to manipulate its own attributes, thereby fulfilling a particular responsibility, or a class can collaborate with other classes. Collaborations identify relationships between classes Collaborations are identified by determining whether a class can fulfill each responsibility itself three different generic relationships between classes [WIR 90]: n n n the is-part-of relationship the has-knowledge-of relationship the depends-upon relationship California State University, Fall 2007, Part II 127

Composite Aggregate Class California State University, Fall 2007, Part II 128

Composite Aggregate Class California State University, Fall 2007, Part II 128

Reviewing the CRC Model n All participants in the review (of the CRC model)

Reviewing the CRC Model n All participants in the review (of the CRC model) are given a subset of the CRC model index cards. n n n All use-case scenarios (and corresponding use-case diagrams) should be organized into categories. The review leader reads the use-case deliberately. n n As the review leader comes to a named object, she passes a token to the person holding the corresponding class index card. When the token is passed, the holder of the class card is asked to describe the responsibilities noted on the card. n n Cards that collaborate should be separated (i. e. , no reviewer should have two cards that collaborate). The group determines whether one (or more) of the responsibilities satisfies the use-case requirement. If the responsibilities and collaborations noted on the index cards cannot accommodate the use -case, modifications are made to the cards. n This may include the definition of new classes (and corresponding CRC index cards) or the specification of new or revised responsibilities or collaborations on existing cards. California State University, Fall 2007, Part II 129

Associations and Dependencies n Two analysis classes are often related to one another in

Associations and Dependencies n Two analysis classes are often related to one another in some fashion n In UML these relationships are called associations Associations can be refined by indicating multiplicity (the term cardinality is used in data modeling In many instances, a client-server relationship exists between two analysis classes. n In such cases, a client-class depends on the server-class in some way and a dependency relationship is established California State University, Fall 2007, Part II 130

Multiplicity California State University, Fall 2007, Part II 131

Multiplicity California State University, Fall 2007, Part II 131

Dependencies California State University, Fall 2007, Part II 132

Dependencies California State University, Fall 2007, Part II 132

Analysis Packages n n n Various elements of the analysis model (e. g. ,

Analysis Packages n n n Various elements of the analysis model (e. g. , use-cases, analysis classes) are categorized in a manner that packages them as a grouping The plus sign preceding the analysis class name in each package indicates that the classes have public visibility and are therefore accessible from other packages. Other symbols can precede an element within a package. A minus sign indicates that an element is hidden from all other packages and a # symbol indicates that an element is accessible only to packages contained within a given package. California State University, Fall 2007, Part II 133

Analysis Packages California State University, Fall 2007, Part II 134

Analysis Packages California State University, Fall 2007, Part II 134

Behavioral Modeling n The behavioral model indicates how software will respond to external events

Behavioral Modeling n The behavioral model indicates how software will respond to external events or stimuli. To create the model, the analyst must perform the following steps: n n n Evaluate all use-cases to fully understand the sequence of interaction within the system. Identify events that drive the interaction sequence and understand how these events relate to specific objects. Create a sequence for each use-case. Build a state diagram for the system. Review the behavioral model to verify accuracy and consistency. California State University, Fall 2007, Part II 135

State Representations n In the context of behavioral modeling, two different characterizations of states

State Representations n In the context of behavioral modeling, two different characterizations of states must be considered: n n n the state of each class as the system performs its function and the state of the system as observed from the outside as the system performs its function The state of a class takes on both passive and active characteristics [CHA 93]. n n A passive state is simply the current status of all of an object’s attributes. The active state of an object indicates the current status of the object as it undergoes a continuing transformation or processing. California State University, Fall 2007, Part II 136

State Diagram for the Control Panel Class California State University, Fall 2007, Part II

State Diagram for the Control Panel Class California State University, Fall 2007, Part II 137

The States of a System n n state—a set of observable circum-stances that characterizes

The States of a System n n state—a set of observable circum-stances that characterizes the behavior of a system at a given time state transition—the movement from one state to another event—an occurrence that causes the system to exhibit some predictable form of behavior action—process that occurs as a consequence of making a transition California State University, Fall 2007, Part II 138

Behavioral Modeling n n make a list of the different states of a system

Behavioral Modeling n n make a list of the different states of a system (How does the system behave? ) indicate how the system makes a transition from one state to another (How does the system change state? ) n n n indicate event indicate action draw a state diagram or a sequence diagram California State University, Fall 2007, Part II 139

Sequence Diagram California State University, Fall 2007, Part II 140

Sequence Diagram California State University, Fall 2007, Part II 140

Writing the Software Specification Everyone knew exactly what had to be done until someone

Writing the Software Specification Everyone knew exactly what had to be done until someone wrote it down! California State University, Fall 2007, Part II 141

Specification Guidelines California State University, Fall 2007, Part II 142

Specification Guidelines California State University, Fall 2007, Part II 142

Specification Guidelines California State University, Fall 2007, Part II 143

Specification Guidelines California State University, Fall 2007, Part II 143

Specification Guidelines California State University, Fall 2007, Part II 144

Specification Guidelines California State University, Fall 2007, Part II 144