Software Process
Software Process
433-641 E. Kazmierczak
Topics Covered
The range of topics that we will be exploring1 follows. Topic 1 An Introduction to Requirements: where we will explore the textbook understanding of requirements and the role that they play in the software engineering process, the impact that they have and the goals of requirements engineering. Topic 2 Software Engineering Processes: where we will explore the role that requirements play in software engineering processes, and to how requirements engineering processes and software engineering processes are inter-related. Topic 3 Requirements Elicitation: where we will classify requirements, study elicitation techniques for requirements, and (qualitatively) evaluate their effectiveness. We will also seek some experience of elicitation methods but this will depend on the projects available. We will also look at Use Cases and other notations as a vehicle for problem understanding.
Please note that the word exploring is used and not the word studying. We will be hopefully be taking a more exploratory and questioning approach and doing some of our own research in this subject, and not just being lectured!
1
Topic 4 Requirements Analysis: where we will explore ways of deepening our understanding of the problem domain, the clients needs and way of making trade-offs. In particular we will be using UML as a notation for structuring and modelling the problem domain. Topic 5 Requirements Specication and Validation: where we will look at specication techniques for requirements and particularly what makes a good requirements specication. Topic 6 Measurement and Metrics for Requirements: where we will investigate some of the metrics, or measurements, that can be applied to requirements and their applications. Topic 7 Special Requirements - USABILITY: here we will explore a special set of requirements for usability. Usability is vital for many applications but needs special analyses and approaches specic to understanding the ways that people interact with computer systems. Topic 8 Special Requirements SAFETY: here we will explore the special topic of requirements analysis in safety engineering. The reason for exploring safety is that it is a good example of requirements engineering for a special domain where the standard approaches must be augmented in order to meet the stringent safety standards required in most safety critical applications.
Contact Details
Ed. Kazmierczak Email Room 3.20, 111 Barry Street [email protected]
Background Material
This course assumes a familiarity with the aims, methods and processes used in software engineering. Students who do not have this background material are urged to read the following texts in order to gain an understanding of software engineering basics.
Generic Skills
As part of this subject you will be required to understand both technical and people related problems and to derive solutions to them. You will be required to present your ndings and to work in small teams on project work. The subject aims to impart general communication, teamwork and problem solving skills and to deepen your skills in analysis and critical evaluation of your solutions. 4
the system, and organise all of the information in a clear and unambiguous manner. Requirements analysis may occur repeatedly during the course of the development of a piece of software. There are many possible paths to understanding requirements engineering but time prohibits us from exploring them all. Our path in this subject will be to view requirements engineering as a problem understanding and domain analysis exercise. The set of requirements for the software come from this analyses.
Figure 1.1: The relative costs of correcting errors made at the requirements stage of a project. times as costly to x as an error detected in the coding stage. An error detected in the maintenance phase is 20 times as costly to x as an error detected in the coding stage. Figure 1.1 gives the cost of detecting and repairing an error in the coding phase relative to the cost of detecting and repairing errors in other phases . To understand better the reasons for the multiplying factor Figure 1.2 shows the cumulative effects of errors made at the various stages. Other studies, such as the one reported in Sallis et.al. [19] estimate that the percentage of errors in released software due to specically to requirements to be in excess of 50% of all errors detected. Similar evidence suggests that concentrating effort earlier in software development processes can have a dramatic effect1 .
Correct Spec.
Erroneous Spec.
Correct Design
Erroneous Design
Correct Programming Programs based Programs based Programs Errors on erroneous on erroneous design spec.
Uncorrectable Errors
Hidden Errors
Requirements Elicitation The process through which clients and developers review, articulate and understand the needs of the clients and the constraints on the software. Requirements elicitation requires involvement with the client, domain experts, and end-users (at least!) in order to establish an the clients needs and the constraints on the computer system must have. Here we use techniques such as: (1) Interviews, (2) Questionnaires, (3) Focus groups, (4) Apprenticing, and (5) modelling. Requirements Analysis The process of analysing the needs of the clients in order to arrive at a denition of the requirements. If elicitation activities are intended to gather constraints then analysis aims to deepen our understanding of the constraints and client needs. Typically, modelling of the requirements is involved and is done while also eliciting requirements. Requirements Specication The process by which a document is developed which clearly communicates the requirements. The viewpoint that we want to develop in these notes is that the requirements exists independently of their specication2 The requirements are captured, or expressed, or articulated, in a software requirements specication. The IEEE has put down eight criteria for an SRS to be considered acceptable and these are: (1) correctness of the requirements, (2) completeness of the requirements, (3) consistency of the requirements, (4) trace-ability of the requirements, (5) Prioritorisation of the requirements, (6) that the requirements be unambiguous, (7) that the requirements be testable, and (8) that the requirements be modiable. Requirements Validation The process of ensuring that the requirements and the Software Requirements Specication are in compliance with the needs of the clients and the system. Validating the requirements is not an easy task as the clients, end-users or domain experts may not even know what correct ought to be. A good example of this was th early days of the A3420 Airbus project where design and problem understanding evolved almost together. Some techniques here include (1) reviews, inspections and walkthroughs of requirements, and (2) prototyping. Requirements Management The planning and controlling of the requirements engineering processes. Typically, requirements management also means being able to track the dependencies between requirements. Good requirements management often requires good requirements management tools. Requirements are divided into four chief classes. Functional Requirements: Functional requirements determine what the system must do. The key functions of the system determine what must be transformed, accomplished, produced or provided by the system. For example, the software for an A320 Airbus must provide: a safer ying envelope by maintaining the aircraft between its maximum climb angle and maximum angle of descent3 .
Then we can talk about the logic consistency of the requirements and their groupings independently of how they are actually set out on paper. 3 The maximum angle of climb is called the ceiling and the maximum angle of descent is called the oor.
2
10
ight alleviation functions such as stability during turbulence. Functional requirements are not concerned with how these functions are to be achieved, just what is to be achieved. The Underlying Information Model: The information model for the problem domain consists of a logical representation of what information resides in the system, who needs the information and where does it come from, what processing of the information occurs and who processes it, what transformations of the information take place.
The Intended Behaviour of the System: The behaviour of the system is how it responds to external events, for example, if we click the right mouse button when viewing a window, how should the system respond. More importantly, if an Automated Braking System detects a vehicle within a specic distance what should the behaviour of the vehicle be? Should it slow? Should it apply brakes fully? We must answer these questions if we are to determine the behaviour of the system. Non-functional Requirements: This category deals with attributes, or properties, of the software rather than functions. We include here aspects of the software such as its performance, its usability, its reliability, any safety aspects and a range of other attributes. The context of the system, and this includes the needs and aspirations of the client, the potential user community, regulatory bodies and other stake-holders, must also be taken into account. This include here the environmental and physical factors as well as the developers risks, available technologies, expertise and costs.
11
ok ok
ok
ok
(e) The product space (c) Developers perspective (d) Technological risks
12
Potential users too may be able to express their wants quickly and effectively, but again it is the engineers task to determine what is actually needed. Users are typically also concerned with functionality, reliability and performance but are also concerned with their interaction with the system, that is, its usability and interface, as well as the impact that the system will have on them and their tasks. The developer also has a perspective on the system. In addition to delivery of a product which satises the customers requirements the developer is often concerned with legal issues, market share, time-to-market, protability, relationship to existing products and in-house expertise to do the job. The legal and ethical framework in which the software is to operate will certainly inuence requirements. This is especially relevant to safety critical systems where the cost of a mistake can be catastrophic. Technology has a major impact on the product space, and the possibility of completing a project in the required time-frame may depend critically on the choice of technology. Questions include the following: What are the risks of using existing technology? What are the risks of using yetto-be-developed technology? What technology will give us the best chance of success and will it be available in time? During problem analysis all aspects of the problem domain need to be investigated, that is, investigate the needs of the clients, investigate the needs of the current users, investigate the functions performed by these people, and investigate the physical, intellectual, legal and ethical environment that people must work in. Davis makes the point that a problem analysis usually involves people. In the case of most software projects it will involve the client or their duly appointed representatives, the potential users of the system, technical and domain experts and perhaps even representatives from regulatory bodies. Such people have an enormous amount of knowledge about the problem domain in their heads and it is the job of the analyst to extract as much of that knowledge as possible. Typically, interviews, formal meetings with chairman and secretary, questionnaires and direct observation are methods used to determine what information is present. The process of gathering information is however, iterative. Once we have established certain facts we may know better what further questions need to be answered. Remark 1.1 There is a tendency to start solving the problem and do design work during problem analysis. The two activities are very different. Analysis traditionally focuses on understanding what the clients needs are and what the system should do to meet those needs. Design is focused on how to achieve those needs. Ideally, we would like a clean separation between requirements and design but in practice this is difcult. The nal requirements specication must take into account the feasibility and cost of requirements and so a technical assessment of the system must have been made. Some very recent thinking has suggested that architectural design and the requirements specication should be done at the same time. 13
Oestereich, in his book Developing Software with UML is actually talking about more specically about creating object-oriented analysis and design models but his comments are accurate in the more general context of requirements engineering.
14
15
16
Software Engineering Processes Engineering Methods Development Tools and Environments Implementation Platforms
Lifecylce Processes e.g. Waterfall, Iterative or Evolutionary processes Methods for "building-in" desired properties of the software e.g. performance, reliability or usability; or methods for requirements engineering or design. Case tools, debuggers, documentation tools, version control and configuration management tools. Hardware, operating systems and implementation languages.
Figure 2.1: The layers at which control can be exercised in a software engineering project. Denition 2.1 Software engineering is the establishment and use of sound engineering principles in order to obtain economically, software that is reliable and works efciently on real machines. The IEEE standard [8] renes this denition and puts it in the following form. Denition 2.2 Software Engineering: (1) The application of a systematic, disciplined, quantiable approach to the development, operation and maintenance of software, that is, the application of engineering to software. (2) The study of approaches as in (1). Another denition appears in Peegers book [14], although it is not so much a denition as a perspective, much like ours, to software engineering. Denition 2.3 Software engineering is about using our knowledge of computers and computer related systems to solve problems.
18
required characteristics are achieved in the nal product. In this context, quality is a set of characteristics that we want to build into any piece of software, and our job as requirements engineers is to identify the key quality drivers and attributes for the software project. What is Software Quality? Ask ten different individuals what software quality means and you are likely to get ten different answers. Here is a sample of the possible viewpoints on software quality. 1. End-user Perspective: Typically, end-users judge the quality of a product by their interaction with it. For users a system has quality if it is t for purpose, reliable and has reasonable performance, is easy to learn and use and helps the users in achieving their goals. Sometimes, if the functionality is hard to learn but is extremely important and worth the trouble of learning, then users will still judge the system to have high quality. 2. Developers Perspective: The developers perspective typically also includes the number of faults that the system has, ease of changing the system, ease of testing the system, the nature of the design, the re-usability of components, conformance to requirements, and resource usage and performance of the systems to judge quality. 3. Maintainers Perspective: The maintainers perspective certainly includes many of the developers perspectives on quality but also includes the simplicity and modularity of the system, the documentation produced by the developers and the ease of understanding the implementation. Ideally, the job of the software engineer is to choose processes tools and techniques to monitor and control the quality of the products being developed or the quality of the processes being used to develop the product. Monitoring the quality of a product or a process often involves the measurement or assessment products or processes to see if they meet the right level of quality. But, how do we determine the right level of quality? How can we measure or evaluate quality? There are a number of facets to quality. Adherence to Standards It is generally accepted that quality software is developed according to standards. Such standards may be formal external standards such as the IEEE or the IOS/IEC software engineering standards (see chapter 3 below) or indeed standards developed by the project team. Certainly, safety critical or high integrity software must be developed according to very rigid standards. Ensuring that software is developed according to standards is aimed at ensuring that the each component of the nal product undergoes exactly the same analysis, design, verication and documentation processes as every other component. Consequently the standard of the nal product is uniform and meets the expectations of the organisation and our community; even if it has been developed by a team. As an example, a requirements specication can be developed according to the Standard IEEEStd. 830-1998 and reviewed to ensure that it meets the criteria in IEEE 830-1998 as the quality gate. Satisfy the Clients Needs The software must be t for purpose and must meet the clients needs. The emphasis here is on establishing quality gates that ensure that the clients needs are met and that the software being developed is t for purpose at every stage of the development.
19
Satisfy Explicit Requirements The nal product must satisfy the requirements of the project. The emphasis here is on proper design and trace-ability of requirements through to code, as well as quality gates which will ensure that the code meets its requirements. However, ensuring that the product is correct with respect to its requirements is only one aspect of the quality of a product and we will also need to ensure that the product meets other quality attributes, or nonfunctional requirements. Satisfy Implicit Requirements Even though explicit requirements are met by the software there are still a host of implicit requirements that characterise good software and these obviously include the quality attributes. There is a trade-off here! Typically, there is not enough time or money in a project to engineer everything to the highest level of quality. We must decide on what quality attributes, or implicit (non-functional) requirements are important and expend effort in assuring these. Quality cannot be measured or assessed directly except perhaps by having someone inspect artifacts for quality. The problem with inspection alone is that it relies heavily on an individuals understanding and interpretation of quality. Ideally, we would like to remove such biases where-ever possible and seek more objective measures of software quality. For this reason software engineers often build models that break quality down into a number of attributes. An early model of quality and its attributes was given in the ISO standard ISO-9126 and part of it is shown in Table 2.1 below.
Characteristics Functionality
Sub-characteristics Suitability Accuracy Interoperability Security Maturity Fault Tolerance Recoverability Understandability Learnability Operability Attractiveness Time Behaviour Resource Utilisation Analysability Changeability Stability Testability Adaptability Installability Co-existence Replace-ability
Reliability
Usability
Efciency
Maintainability
Portability
21
themselves may be multi-faceted, for example, we may have architectural views of a system, detailed, or algorithmic, views of program modules, a control hierarchy for the system and data ow. Coding is the activity by which designs, or design elements, are translated into machine readable form. This, and testing, are the real realisation activities of an engineering process. Testing is actually a set of activities which are aimed at uncovering errors in the system. Testing can be conducted at several different levels: unit testing, integration testing, system testing and acceptance testing. Maintenance is the process by which the system is extended, corrected and enhanced. Maintenance activities can encompass requirements, that is new requirements for the system, design, coding and testing as well as correcting errors. In general, a processes consist of a number of phases, each of which can consist of a number of other activities. In general, a phase has a number of inputs, a number of outputs and typically requires a quality check, as in Figure 2.3.
Quality Test
Inputs
Process
Outputs
Figure 2.2: A diagrammatic representation of a typical software engineering process phase. Example 2.1 The software engineering standard IEEE Std. 830-1998, IEEE Recommended Practice for Software Requirements Specications species eight properties of a good Software Requirements Specication: (1) Correctness, (2) Completeness, (3) Consistency, (4) Trace-ability, (5) Veriability, (6) Modiability, (7) Clarity and conciseness of specication, and (8) prioritorised requirements. To determine if the software requirements specication is acceptable an SRS review can be held. If an SRS review is to be the quality gate for the requirements phase then the SRS must be reviewed against the eight criteria above if we are to assure ourselves that the SRS satises IEEE std. 830-1998. In general, the ordering of the phases, the choice of quality checks and the activities making up a phase constitutes a process (or process model). A number of such process models have been proposed in the literature (see, for example, [16, 21]) in order to cope with various kinds of project circumstances. These include: Variants of the linear sequential, or waterfall, model; 22
Interviews Questionnaires User Interface Prototypes External Documents Quality Gate: SRS Review Requirements Phase Software Requirements Specification
Figure 2.3: A possible requirements phase in a waterfall development process. Prototyping models; The Rapid Applications Development (RAD) model; Evolutionary models The Incremental model; The Spiral Model model; and The Concurrent Development model. Agile Processes. The Rational Unied Process. Each process has its own peculiarities, for example, the Spiral model [2] combines prototyping with aspects of the waterfall model to minimise the risk of missing or misunderstood requirements.
23
Requirements
Design
Coding
Testing
Maintenance
Figure 2.4: The Waterfall Model Baseline management is a variation on the waterfall model which allows for iteration within a phase and stringent conguration management procedures for base-lining the results of a phase. As the name implies, in the pure waterfall model each phase should ideally be completed before the next one is commenced. In practice, however, this is not always true, for example, architectural design may be started before requirements analysis is complete. Supporters of the waterfall model claim that is provides good support for projects which are relatively well understood and provides a good model for estimating project costs and tracking progress (see for example, [4, 21]). To make the waterfall model more effective, feedback from later phases may feed-back into earlier phases, for example, an unforeseen technical constraint may force additional investigation of the problem domain. Also, prototyping at the requirements and design phases may be added in order to improve the developers condence in the outcomes of these phases (see Figure 2.5). Detractors of the waterfall model assert that it does not take into account the technological and domain directed risks inherent in software projects [2, 14], nor does it allow for the iterations that are required as understanding of a project evolves during the course of a project [14]. Further, for large and complex processes there is not enough feedback provided to client and it may be months (or years) between commissioning a system and seeing some part of it working. This implies that requirements for a waterfall development should remain relatively stable throughout the project. Unless the project is in a well understood domain where iteration over artifacts is not necessary then the waterfall is not suitable. Note that each major phase within the waterfall model is concerned with the production of an artifact in the very way as depicted in Figure 2.3. The early phases are consequently, not only concerned with developing a complete description of what needs to be done but also of what can be feasibly implemented. Another version of the waterfall is the V model (see Figure 2.6) which is used in projects where safety, correctness and high levels of assurance need to be given. Its is easier to see from Figure 2.6 that requirements do not only have an impact on the development but also on the systems verication 24
Requirements
Design
Feasability Study
Corrections
Review
Requirements
Corrections
System Design
Corrections
Program Design
Corrections
Program Testing
Code
Figure 2.6: The V model of software development which matches up development stages with assurance activities.
25
and acceptance. However the model is presented, the emphasis on understanding the problem domain and eliciting a stable set of requirements is shifted to the early phases of the project. A corresponding increase in effort should therefore be made to elicit, specify and validate requirements early in the development process.
Design
Code
Test
Integrate Maintain
Figure 2.7: Incremental development of design, coding, testing and maintenance phases. In principle requirements analysis must be done at the start of the project, as in the waterfall model, but in practice feedback from users can inuence both the requirements of latter increments and the design of latter increments. While incremental delivery offers more exibility than a waterfall and reduces some of the risks of a changing environment, the process needs to well managed. If requirements are changing then we must at least keep an accurate record of which requirements pertain to which increment. Typically we would want to ensure good conguration management procedures before commencing incremental development.
26
Risk Analysis Risk Analysis Risk Analysis Prototype Req. Plan Concept Phase Development Plan Integration and Test Plan Plan Next Phase
Detailed Design
Figure 2.8: The Spiral Model The spiral model (see Figure 2.8) allows for a complete re-evaluation of the project direction after each spiral, and this of course means that requirements can be re-evaluated. Again, there is an issue with managing the spiral model and requirements need to be managed carefully. In particular, we need to ensure that new insights, which lead to new requirements are consistent with prior requirements and with the what has been built thus far. The purpose of this chapter is to understand the role of requirements engineering in the context of software engineering. Indeed, requirements analysis (in some form) is an integral part of all of the software engineering development processes used to today.
27
28
29
Pressman suggests some questions which are aimed at uncovering context and client expectations, that is, points (B), (C) and (D) above. Pressman suggests that these questions should be asked rst but in practice they can end up being asked at anytime. 1. What is the new system intended to achieve? What is it intended to replace? What sort of system would you like? 2. Who will the users be? Who will the operators and maintainers of the system be? 3. Is there an existing system which is similar? What is wrong with it? How can it be improved? Is there are manual or paper system in place? Where can it be improved? Why have you decided to automate? What savings or economies do you expect? 4. What will the real benet of the new system be to you? 5. What sort of environment will the system be used in? We can then follow-up the questions in Figure 3.1 with questions designed to to understand point (A). 6. What should the system achieve? 7. Can you provide examples of inputs and outputs for the system? Can you provide samples of reports or data for the existing manuals system? 8. What standards does your company use? What standards would effect this project? 9. What special properties do you expect this system to have? Should it be: safe, reliable, high performance or real-time, secure, have high levels of usability.
Figure 3.1: Some suggested questions for starting the requirements process in an interview.
31
the software is to be sold on the free market then other forms of funding, such as venture capital, corporate sponsorship or government assistance, must be found. The point of all this is that by the time we are actually ready to plan and launch our project there has already been a signicant amount of activity with a potentially large cast of characters. It is important to understand who has been involved in establishing a project and what their stake is. Answers to the following questions contribute to project risk, requirements and ultimately choice of development model.
Identifying Stake-holders
Identifying all of the stake-holders early in the project is important for the project management, nding all sources requirements and for understanding the constraints on the project. Stake-holders in a project are those people, groups or organisations that have an interest, or a stake, in the software or will, in some way, be affected by the software. The key stake-holders in a project are usually the client for the project, the sponsor of the project, customers, end-users, and the developers of the software. Other potential stake-holders include the technical experts, developers of interconnected systems, regulatory bodies, other professional bodies. There are important reasons for identifying all of the stake-holders in a project, what each of them controls in the project, and their motives. Identifying the stake-holders for a project is important for requirements analysis. If all of the relevant stake-holders are not included in the requirements analysis process then there is a danger that some potentially critical requirements will be missed. A good understanding of who controls what in the project can help to resolve conicts and inconsistencies in requirements, and knowing who controls your project is certainly important if you need to negotiate for more time or money. Understanding the area of control and the motives of stake-holders such as any independent auditors and reviewers involved in your project can help you to prepare and meet their concerns without delay to the project. Understanding the motives of your stake-holders also lets you determine the best ways of approaching stake-holders during the project and perhaps anticipating how they will react in different circumstances. Some of these points are tied to project risk.
Questionnaires, Focus Groups, Direct Observation, Apprenticing, Brainstorming, Joint Applications Development; Prototyping, and Use Case Modelling. Interviewing, focus groups, apprenticing and brainstorming uncover information in the form of business rules and processes, standards, legal and ethical constraints, users likes and dislikes and their working habits, as well as what needs to be transformed, provided, accomplished or produced. Models in the from of formal methods or in the form of Object Oriented models can a key aid for organising all of this information and uncovering inconsistencies, incompleteness and ambiguities in the gathered information. Finally, good modelling methods and notations allow us to systematically understand how each piece of information ts into the workings of the whole. Use case modelling we will deal with in Chapter 4 and prototyping we will deal with in Chapter ??.
Interviewing
Interviews can be conducted with clients, end-users, technical experts, or indeed any of the stakeholders associated with the project. Interviews provide a good form of Data Collection about the problem requiring a computer solution as perceived by the interviewee. Note, that capturing expert information is often critical but also often overlooked. Ideally, information gathered during an interview should be veried from other sources or crosschecked. This reduces some of the potential biases in interviewees. Interviewing is exible and encourages participation of the stake-holders in the project but interviewing requires expertise and much practice to get procient. There can, however, be a tendency to gather Soft information that is too vague to use. Poor or inexperienced interviewers may leading the interviewee or develop Selective hearing of interviewee. An interviewers opinion may be inuenced by stereotyping of interviewee. There is also the danger that the information gathered may not grounded in fact.
Questionnaires
Questionnaires have the potential to gather large amount of data quickly, can be precisely targeted and are relatively inexpensive to run. They can be conducted with large numbers of people audience by using mail or email and often do not require much time for staff to ll in. More importantly, questionnaires permit anonymity in requirements elicitation and can be supported by technology. 33
The problem with questionnaires however, is that designing them can be difcult, questions can be ambiguous and the lack of direct contact prevents clarication of issues. More typical is a poor response rate and the data can remain untested unless good follow-up methods are employed. There is also a danger that the respondents may be careless in lling in questionnaires or may feel antagonised at having to ll them in.
Focus Groups
A focus group is a relatively informal meeting of a small group of people (some sources recommend keeping the number above ve but under ten people) who represent one or more aspects of the requirements. For example, we can have a focus group on the user interface design in which a representative selection of the people who must use the system are present. Focus groups are excellent for bringing out spontaneous reactions and are a good way of getting from people what they actually want from the system. The group atmosphere may stimulate ideas and may help to bring issues in the requirements into the open. Focus groups can be problematic in actually resolving the issues and for making decisions about requirements. Focus groups will not generally provide requirements detail or know what the constraints on a system should be.
Direct Observation
Direct observation means observing users conducting the tasks (not necessarily all of the tasks) that they will be carrying out with the new system, but using an existing or manual system. It is widely accepted in the HCI community that direct observation is essential for understanding tasks in a situation. Direct observation is a good starting point prior to more extensive observation and can be inexpensive. It is also a valuable information-gathering tool where the requirements engineer gains insight about what is actually done, not just what is documented or explained. Users, however, can get resentful at being under constant observation and the th e presence of an observer may affect what is observed (Hawthorne effect). Further, decisions must be made about what is important to record and since these decisions must usually be made quickly, there is a possibility of missing important events. A renement of this technique is the technique of apprenticing where the requirements engineer actually conducts the tasks that users of the system will be carrying out. This has the added benet that the requirements analyst gains critical insight into the tasks required of the new system. There can, of course, be difculty communicating and capturing some of this insight but if the analyst is an integral part of the development team then apprenticing can be a powerful tool for understanding what tasks a system must support.
Brainstorming
Brainstorming can be an effective way to generate lots of ideas in a short space of time. It works by having a number of people in a relaxed informal environment. The statement or problem for which 34
ideas are sought is stated and then the people in the session simply shout out ideas until the time limit is reached. All of the ideas are captured and after the meeting these ideas are sifted to determine which idea(s) best solves the problem. There are rules to a brainstorming session, for example, no criticism of ideas is allowed and no discussion of ideas is allowed. Brainstorming is good for creative input into a requirements session, perhaps when something new is being sought or there is a difcult problem to overcome. Brainstorming is not appropriate for any kind of analysis or for decision making.
Inspecting Documents
Inspecting documents is a good means of gathering requirements where existing systems have been formalised. The information gathered is usually qualitative but the data is also usually reliable. Documents are a good source of information for checking facts from other sources as they do not rely on staff cooperation. Informal systems and processes, or those systems and processes that are not documented are typically missed. Further, there is a problem with documents eventually becoming dated and so there is a need for the requirements analyst to ensure that documents are current and live! Document inspection can be time consuming so there is often a need to be selective. Also, data may not be in an immediately usable form and there is usually no information on attitudes or opinions.
35
36
37
Figure 4.1: A simple use case diagram for the book borrower example. Note that it is the role that is important and the actor exemplies that role. A further aspect of analysis is that not all actors will necessarily gain benet from the use case even though they may be involved. An actor who gains value from a use case will be referred to as a Beneciary [15]. Identifying the beneciaries of a use case is valuable for motivating the need for a specic set of functions or behaviours, for if the system has no beneciaries then we are likely to be in a situation where somebody believes that it is good to automate something but nobody really wants the system. Actors can be human, but they can also be devices or external computer systems. In this case we must determine use cases at the right level of abstraction, for example, it may not be appropriate to treat the mouse and keyboard as external devices in many contexts. Including irrelevant detail will often complicate the model. Ultimately the decision on what detail to include is pragmatic, but some guidelines are offered in [15] who suggests that there are three choices of when to show interactions when dealing with external devices: always, when the other device or system initiates the contact, and when the other device or system is the beneciary. In this course we will use use cases, and UML models, to rene our requirements, integrate new requirements and to informally check the consistency and completeness of our requirements. Of course, there is still the problem of elicitation to deal with before any real modelling can occur. Returning to our library example we may have the following set of scenarios. 1. Mary Bloggs borrows the third copy of War and Peace when she has no other books on loan. The loan is allowed and the catalogue is updated accordingly. 2. John Smith attempts to borrow the rst copy of Anna Karenina but he already has the maximum number of books on loan and so is refused the loan. 3. Alan Alder attempts to borrow the second copy of Crime and Punishment but must get authorisation from the librarian Mary Bloggs because he has an overdue book. Mary Bloggs authorises the loan and the catalogue is updated accordingly. 39
The rst two scenarios are instances of the use case diagram shown in Figure 4.2 but the third scenario is not because it involves the Librarian actor which is not part of this diagram. To capture the third
Borrow a Copy of a Book Book Borrower
Figure 4.3: Observe that these scenarios can get quite complex, that there are variations in the use cases, and that they can be structured. Thus, use cases can embody complex requirements for the system. Thus we need to: provide detailed scenarios for each use case, and specify the circumstances under which each scenario applies. This information can be provided either textually, perhaps using the template for specifying ow of events as shown in Figure 4.4 [13], or using UML activity diagrams. Modelling requirements via use cases requires two simple steps; 1. Identify actors and beneciaries, 2. For each actor, what they need from the system, that is, what use cases have value for them, and any other interactions they expect to have with the system, that is, which use cases would they participate in for somebody elses benet. Use cases are a scenario based elicitation and modelling technique. A group of related scenarios relating to the tasks that the user wants or needs to accomplish are collected into a Use Case. The library use case diagram may appear as follows. The beneciary of the use case is the borrower while the librarian is required in order for the borrower to derive benet from the Borrow use case. The supervisor and librarian are required for the library to complete the Fine task. 40
Use Case 2.2 Name Actors List the actors Trigger List the circumstances under which this use case is activated. Process Specify the steps in carrying out the use case. Variations List the variations to the steps above and specify the points at which they occur. Dialogs A specication of the dialogue that the actors have with the system while carrying out this use case. It can include screen shots to show layout or diagrams to show the path through a set of screens. Open Issues List the open problems and unresolved issues. Figure 4.4: A template for specifying use cases.
Fine
Superivsor
Figure 4.5: A Possible Use Case diagram for a simple library system.
41
Names
Large systems involve large numbers of objects. In UML the key tool for organising large numbers of modelling elements are packages, but we may think of packages as subsystems of the whole as well. Use cases are not specically tied to UML and so they are applicable in any analysis situation. The names of use cases may reect the structure of subsystems. Thus names can be Simple names consisting of a single text string, or path names which is a use case prexed by a UML package to which it belongs, or a subsystem to which it belongs.
Figure 4.6: Generalisation between actors. ble of performing other behaviours which extend or vary in specic places from the behaviours of a customer. Use cases can be structured in much the same way as class diagrams, for example, we have generalisation, inclusion and extension as the basic means of structuring use cases.
Generalisation
Generalisation between use cases is very similar to generalisation between classes in Object Oriented Analysis; the child use case inherits all of the behaviour of the parent use case. The child may, however, extend and override the parent and so alter its meaning. The notation appears as in Figure 4.8 where the arrow always points back to the parent. Perhaps more importantly, the child use case can be substituted anywhere the parent use case appears. As an example, the use cases Check Password and Retinal Scan generalise the use case Validate User. In this case Check Password and Retinal Scan are the children of Validate User, have the same behaviour as Validate User, and can can be used anywhere that Validate User can be used. 42
Place Order Extension Point Set Point <<include>> Inclusion Validate User <<include>> Track Order
<<extend>> (Set point) Place Rush Order Extension Check Password Generalisation Retinal Scan
Parent
Child
43
Inclusion
Inclusion between use cases signies that the base use case explicitly incorporates the behaviour of the use case at the tip of the arrow at a specic location in the base. An include use case is used to avoid describing the same ow of events numerous times by allowing common behaviour to be put into another use case and then included where necessary. As an example, in Figure 4.7 the use cases Place Order and Track Order include the use case Validate User. The use case for Track Order may contain the following ow of events. 1. Obtain and verify order number. 2. include (Validate User). 3. For each part in the order, query its status and then report back to the user.
Extension
Extension relationships are used to model the parts of the use case that the user sees as optional. The base case may stand alone, but under certain conditions its behaviour can be extended by another use case. For example, we may have the following in place order. 1. include (Validate User). 2. Collect the users items for the order. 3. extend (Set Priority). 4. Submit the order for processing.
(iv) The system requires the appropriate record-keeping and security provisions. (v) The system must handle concurrent access to the same account correctly. (vi) The banks will provide their own software for their computers; you are to design the software for the ATMs and the network. (vii) The cost of the shared system will be apportioned to the banks according to the number of customers with cash cards. (viii) The system must be administered by administrators who are responsible for generating reports. A possible use case diagram for the bank system appears in Figure 4.9.
ATM Customer
<<include>>
Withdrawal
Figure 4.9: The bank system use case diagram There are two chief main use cases in Figure 4.9, ATM Transaction and Create Report. We have assumed that part of the ATM Transaction use case is to Validate the ATM customer. We have also assumed that there are two types of transactions possible: (1) Withdrawal and (2) an Account Check. The Reject use case rejects the ATM Customer if they cannot be validated.
45
Example - Auctions
Bfeore an auctions sellers submit items to be sold to the auction. A valuer and the auctioneer looks over the item with the seller and discusses the value and the price of the item with the seller. They decide on an acceptable (or reserve) price for the item. The auction of an item involves a collection of bidders making increasingly higher offers (or bids) for the item. Initially nothing has been offered, and any bidder can make a bid provided it exceeds the previous bid (though it would make no sense for the same bidder to bid twice in a row). The auctioneer, who conducts the auction, can start counting-out by saying going once, and if no further bids are received, going twice, and if again no further bids are received, the item is declared sold to the highest bidder, ending the auction. Whenever a new bid is received, the auctioneer needs to start the counting-out from the beginning again. If the highest bid does not reach the reserve price then the item is passed in and the next item is brough out. Model this situation as a set of use cases.
46
(2) Filled Broaden and deepen the facades. (3) Focused Narrow and prune use cases. (4) Finished Touched up and ne-tuned use cases. These iterations are not intended to be a process, but rather and as before, set of activities to be conducted as part of a process.
The Facade
The goal of the Facade iteration is to create place-holders for for each major task that that you expect users to have with the proposed system. A Facade use case contains only the minimum of information that is needed as a place-holder, including names, actors and a short description of each interaction. The Facade iteration has the following key steps. 1. Create a problem statement. 2. Identify and review existing documentation and existing intellectual capital. 3. Identify users, the user group management, the stake-holders, the customers being served by the user group, and the owners of any data. 4. Interview the stake-holders. 5. Find the actors. 6. Create the Facade use cases. 7. Start the business rules catalogue. 8. Create a risk analysis. 9. Create a statement of work. 10. Get informal approval from the executive sponsor. The chief output of a Facade iteration is a set of improperly dened use cases, but a set that can be used to dene the scope of the project, its key purpose and tasks. Any more detail and (it is claimed) that you will be hurting the iterative nature of this use-case development method. Example 4.2 An example of a Facade is given in Figure 4.10.
Track Costume Sales Facade System Context Use Case. This system needs to track the information related to customers, appointments, designs, orders, and sales. The purpose of the system is to provide historical sales data that allows the owner to visualise trends.
Basic Course of Events: Alternative Paths: Exception Paths: Extension Points: Trigger: Assumptions: Pre-conditions: Post-conditions: Related Business Rules: Author: Date: John Pea Em. January 1, 2002Facade
48
2. Create lled use cases. 3. Collect and document the non-functional requirements. 4. Add business rules. 5. Test the lled use cases. 6. Put some things off. . . ! Example 4.3 An example of a Filled use case is given in Figure 4.11 where the processing steps for a Process Loan use case can be added to create a lled use case. Use Case Name: Iteration: Summary: Process Load Filled The loan provider and the buyer work out the terms of the loan, if the buyer requires one. Terms include the interest rate, points, term, escrow, insurance, and so forth. 1. The use case begins when the buyer and the seller have agreed to terms. 2. The buyer indicates that a loan is required. 3. The system responds by contacting the loan provider with the details of the buyers loan requirement. 4. The loan provider uses the buyers loan requirement as input to create a loan proposal. 5. The system responds by sending the loan proposal to the buyer and the buyers agent. 6. The buyer makes a counter-offer to the loan provider. 7. The system responds by sending the counter-offer to the loan provider. 8. The loan provider accepts the counter-offer. 9. The system responds by sending notication of the loan providers acceptance to the buyer and the buyers agent. 10. The buyer indicates acceptance of the loan. 11. The system responds by recording the buyers acceptance of the loan and les approved loan application with the loan provider.
Figure 4.11: A Filled use case for processing loans [10]. Where applicable a glossary of terms should also be included with use case in order to ground readers of the use case in the domain. 49
Agree to Terms Focused The buyer and seller agree to the terms of the sale, including changes to the existing property that are required, the items included in property, the date of possession, the nancing arrangements, and any other conditions of the sale. The agents help their respective customers by offering advice, caution and recommendations.
Basic Course of Events: 1. This use case begins when the buyer and the seller both indicate that an agreement is possible. 2. The system responds by notifying the buyer, the buyers agent, the seller, the sellers agent, the legal analyst and the nancial analyst that the agreement process is ready to begin. 3. The buyer or the seller submits a proposal of terms. 4. The system responds by allowing all actors to view the proposal of terms and make their changes. 5. The actors make their changes. 6. The system responds by making the actors changes public to all. 7. The actors discuss the changes and come to an agreement on each proposed change, item by item. 8. The system responds by consolidating agreed-to changes and again making the proposal of terms public. 9. The actors indicate their agreemnet. 10. This use case ends when the system indicates that the proposal of terms is nal.
Figure 4.12: Selling a Property Agreed to Terms Focused Use Case [10].
51
Alternative Paths:
In step 3, the buyers agent may submit a proposal of terms to the buyer, who may then submit it as his own. In step 3, the seller may also be the one to submit a proposal of terms. In step 3, the sellers agent may submit a proposal of terms to the the seller, who may then submit it as his own. In step 9, if the buyer or the seller does not agree to the proposal of the terms as it stands, the objecting party enters his issue; then the objecting party modies the proposal, and processing returns to step 4. None. One of the actors indicates that the agreement to terms can begin. None An offer has been made and accepted. Terms are agreed to by the buyer and the seller. None John Pea Em. Januray 1, 2002Facade, February 1, 2002Filled, March 1, 2002Focused
Exception Paths:
Figure 4.13: Selling a Property Agreed to Terms Focused Use Case Part 2 [10].
52
3. Make nal scope decisions and get the sign-off. 4. Baseline the requirements.
53
54
55
Elicit Requirements
Figure 5.1: Using analysis models to feedback into requirements elicitation. There are a number of possibilities for evaluating and analysing sets of requirements as they are being developed. Model building is one of the most popular and accepted methods of analysing requirements.
5.1 Modelling
A model of the requirements can be used to: test the feasibility of the requirements, help to understand aspects of the problem domain, clarify misunderstandings and act as a laboratory for the imagination [22]. A good model can be modied, extended, reduced or transformed in order to explore requirements. We can argue about the threads of logic and see if they knit together consistently and test the models strengths and limitations. Finally, a good model can be used to guide the requirements elicitation and to gain a better understanding of the problem domain. Some popular modelling approaches are listed below. Formal Methods Here we create mathematical models of the system requirements. Popular methods include 56
Z and B Both are formalisms for writing specications using logic and set theory. Models are usually created by giving an explicit model of the system state, identifying the actions that the system must undertake and specifying exactly how each action affects the system state. The affect on the system state is modelled in terms of the actions preconditions and its postconditions. VDM (The Vienna Development Method) Another formalism using logic and set theory and explicitly designed for modelling states and transitions (or actions) using preconditions and post-conditions. Petri Nets A very mature and surprisingly general formalism and used in numerous engineering disciplines based on the mathematical theory of graphs. Systems are modelled as a set of places representing conditions or assertions about the system, transitions, representing changes in conditions, and tokens. Tokens occupy places. When a token occupies a place the assertion about the system holds (see Figure 5.2). Petri-nets are most often used for understanding problems with resource sharing in multi-
Figure 5.2: An example of a Petri Net process environments. Process Algebra Process algebras have their origins in the mathematical theory of automata. Common process algebras include CCS and CSP but there are others. Systems are modelled as a collection of agents that interact and communicate to achieve a common goal. Each agent engages in a series of actions that can synchronise with the actions of other agents. UML The Unied Modelling Language consists of a number of different sub-languages. UML does not rigorously dene all of its sub-languages although some, like state-charts, do have a rm mathematical basis. More is given on UML in Section 5.2 below. 57
Prototyping Prototyping is where we create executable models of the [1, 7, 11]. Prototypes can be a good way for the development team to gain an understanding of the system and its environment. Prototyping is iterative in nature and the production of prototype can show-up vague or uncertain requirements. Prototyping has the distinct advantage that the client, or even the end users of the system, can be shown how the system might behave in a given situation.
58
59
60
Figure 5.3: Two classes. Relationships hold between objects and relationships hold between classes. There are three basic kinds of relationships in UML. 1. Generalisation, or sometimes inheritance, relationships exist between a general thing and a more specic or specialised thing. A child inherits all of the properties of its parent but child classes may override operations in the parent and extend the parent by adding
1
61
Shape
Parent
Children
Circle Radius:Real
Square
62
more attributes and operations. In particular, generalisation means that the objects of the child class can be used anywhere that the objects of the parent class can be used but not the converse! An example of a generalisation relationship is given in Figure 5.4. 2. Associations are another kind of structural relationship. Given an associations between classes, you can navigate from an object in one class in an associations to an object in another class in the association. Associations can be unary, binary or n-ary and can be named. Typically, association names are used to describe the nature of the association as in Figure 5.5. Associations may also have roles attached to them as in Figure 5.6.
Works for Person Employer
Figure 5.5: An association between Person and Employer classes. Associations may reect multiplicity, that is, an object at one end of a relationship may
Person Employee Employer Employer
Role Names
Figure 5.6: An association between with roles attached to the classes. be related to n objects at the other end of a relationship and vice-versa. Some possible multiplicities include, 1..* 0..* 1 (0..1) (0..1, 3..4, 6..*) One or more Zero or more Exactly one Zero or one Complex ranges Zero or more.
3. Aggregation is an association which relates parts to their whole. The other relationships are typically between peers but the the aggregation relationship is intended to introduce a strict hierarchy between the whole and its parts. An example of an aggregation is given in Figure 5.7.
63
Whole
Part *
Company
Department
Aggregation
Figure 5.7: An aggregation relationship: Company is the whole and Department is the part.
ATM
ATM
A/C
ATM
System
clears transactions with the appropriate banks. An automatic teller machine accepts a cash card, interacts with the user, communicates with the central system to carry out the transaction, dispenses cash, and prints out receipts. The system requires the appropriate record-keeping and security provisions. The system must handle concurrent access to the same account correctly. The banks will provide their own software for their computers; you are to design the software for the ATMs and the network. The cost of the shared system will be apportioned to the banks according to the number of customers with cash cards.
Use Cases
Consider the use case in Figure 5.9. The processing steps all involve Objects and Associations between objects. Object oriented analysis is tries to capture these objects and associations to create a class model. The use cases and the problem statement provide a wealth of information about the objects and associations in the problem domain.
Choosing Objects
Here is a simple method for developing an object model from a use case or a problem description. Step 1 Select potential objects from the Use Case or problem description. Potential objects are usually things (well. . . , objects really!) and a described by nouns or noun-phrases. This list forms the set of potential objects, and object classes. Note, however, that not all items in this list will serve as classes. All objects Step 2 Remove all of the items in the following list. Vague If the object is not unambiguously dened then it should be rejected. Redundant that is, some sets of objects in the problem statement may refer to the same entity. We must ensure that the two object classes are actually distinct. Event or an Operation We must take care to ensure that our potential object does not actually refer to an event or an operation. Outside the Scope of the System We must ensure that the object class must be relevant to the system being specied. This can be hard and is to a greater extent a subjective decision. Attribute If the potential object refers to something simple with no interesting behaviour and which is part of another class then it ought to be an attribute and not an object. Meta-Language If we are using nouns to identify objects then we must ensure that the the noun is part of the language for dening things and not part of the language of the problem domain. What kind of things are we looking for to be good classes? (i) Tangible real world things, for example, ATM and ATM Card. (ii) Roles, for example, Customer and Cashier. 65
ATM Transaction Filled The ATM customer inserts their card into one of the Consortiums ATMs. The ATM customer initiates a transaction and the bank consortiums network carries out the transaction, and delivers back to the ATM customer the results of that transaction.
Basic Course of Events: 1. The ATM customer inserts their consortium ATM card into an ATM. 2. The ATM customer enters their pin-number. 3. The ATM customer chooses their transaction type. 4. The ATM customer enters the details of their transaction into the the ATM. 5. The ATM sends the account details, customers pin number and transaction details to the Consortiums central computer. 6. The Consortiums central computer keeps a record of the transaction, and sends the transaction to the correct bank computer. 7. The bank computer validates the ATM customers pin number, and checks to see that the ATM customers account is in a state that will enable the transaction to be carried out. All ATM costumers must be a customer of one of the consortiums member banks. 8. The bank computer sends back an authorisation number to the central computer. 9. The central computer clears the transaction and sends a message to the ATM to allow the transaction to proceed.
Extension Points:
Step 7 If the ATM customers bank account is not able to support the transaction, or the customer has supplied an invalid pin number the apply the Invalid Transaction use case. The ATM customer inserts their ATM card into one of the Consortiums ATMs. Ed. Kazmierczak April 15, 2003.
Trigger:
Author: Date:
Figure 5.9: An ATM Transaction Use-Case for the Bank Consortium Problem. 66
(iii) Events, and (iv) Interactions. The categories listed above do overlap but this is not that important. What is important is to recall that the objects in the model dene the system and consequently a good choice now may save us a lot of rework later.
Choosing Associations
In general class A and class B are associated if, (v) an object of class A sends a message to an object of class B; (vi) an object of class A creates and object of class B; (vii) an object of class A has attributes whose values are objects of class B, or collections of objects of class B, and (viii) an object of class A receives a message whose argument is an object of class B.
Figure 5.10: The potential classes of the ATM consortium problem categorised . Remark 5.1 This is only one reading of the problem and other models will exist which are equally valid. The choice depends on the set of objects chosen to model the system.
67
Consortium 1 Owns
Consists of *
Issues
Has
Communicates with
ATM
* * Authorised by
* *
68
Responsibilities
In class diagrams it is useful to add the responsibilities of each class, that is, the role that the class plays in the system as a whole. This can be added to a fourth division in the class box if required and is useful for deciding what the attributes and operations should for the class.
Use Cases
We can begin by determining that there are likely to be three main use cases for the simulator and these are given in Figure 5.12. The rst use case Create Virtual Patient is used by the the senior surgical educator or administrator to create a model patient with a specic trauma. The administrator takes a template patient and species the location and the parameters of the trauma and the simulator responds by creating and storing the new patient model. The second use case, Execute DPL Scenario is the main use case for the DPL simulator. It is given in detail in Figure 5.13 but, at this early stage, is still quite incomplete. The nal use case is the Assess DPL Scenario use case where the senior surgeon replays and examines the the actions of the student created in the Execute DPL Scenario and assesses the students performance.
69
Create Virtual Patient Administrator Trainee Surgeon Execute a DPL Scenario Teaching Surgeon
Figure 5.12: Use Cases for the DPL Simulator. Virtual Patient Incision Incision Tool Abdominal Fascia Guide-wire Syringe Tool Site Records of Actions Cannula Tool Bowel Catheter Tool Syringe Abdominal Wall Local Anaesthetic Cannula Guide-wire Tool Catheter Fluid
70
1. The trainee surgeon or the teaching surgeon loads a virtual patient. 2. The trainee surgeon selects a site on the abdominal wall in the virtual patient in which to make an incision. The site is usually just below the umbilicus for lower abdominal injury but can be higher up the abdominal wall depending on the location of the trauma. 3. The simulator records the site chosen for later analysis of the procedure by the teaching surgeon. 4. The trainee surgeon must administer a local anaesthetic and waits for a small period of time for the anaesthetic to take effect. 5. The trainee surgeon makes an incision using an incision tool provided by the simulator. 6. The trainee surgeon selects a cannula tool and inserts the cannula into the incision. The trainee surgeon keeps inserting the cannula until they penetrate the abdominal fascia (a membrane behind the abdominal wall). The surgeon should feel a give or a pop when the cannula penetrates the fascia. Care must be taken not to insert the cannula too deeply and perforate the bowel. 7. The trainee surgeon selects a guide-wire tool and passes a guide-wire through the cannula. 8. The trainee surgeon removes the cannula from the virtual patient. 9. The trainee surgeon selects a catheter tool and threads a catheter over the guide-wire. 10. The trainee surgeon removes the guide-wire. 11. The trainee surgeon selects a syringe tool and inserts the syringe at the end of the catheter. 12. The trainee surgeon aspirates some uid from the abdominal cavity. Testing the uid for blood is not part of the scenario. Trigger: The surgeon suspects that blunt abdominal trauma has occurred and CT and ultrasound scans are not available. Trainee Surgeon Ed. Kazmierczak April 15, 2003.
3. We will include the virtual patient, and assume that Abdominal Wall is a part of the virtual patient. Further we will assume that the Fascia is a part of the abdominal wall. 4. We will assume that the associations between objects arise from the interaction between physical objects. The resulting object model is shown in Figure 5.14.
Record of Actions
History of
Virtual Patient
Administered
Local Anaesthetic
Scalpel 1Make
Incision
Abdominal m
Wall
CannulaInserted
Into 1
Incision
1
Fascia
Bowel Fluid
Inserted Into 1
Guidewire
Catheter
Attached To
Syringe
Figure 5.14: An Initial Model for the Diagnostic Peritoneal Lavage Simulator .
Responsibilities
Table 5.2 shows what responsibilities we have assigned to each of the objects based on our current understanding. We have not captured the responsibility for storing a specic students work on a specic patient model and the association between the Record of Actions and a Virtual Patient looks articial. Further, we also require an object to have the responsibility of stepping through the procedure and maintaining the current state of the procedure. We will add an object called Procedure that incorporates this information. We have made some further assumptions with respect to the models. Each of the objects must be able to display itself as well as carry out its intended function. Thus the cannula must be able to be visually rendered and to be inserted and removed into the abdomen. The rened object model is given in Figure 5.15.
72
Local Anaesthetic
Abdominal Wall
Incision Fascia Bowel Scalpel Cannula Guide-wire Catheter Syringe Record of Actions
Fluid
Responsibility Responsibilities are: (1) hold the state of the patient, and (2) to provide an model of a patient for the scenario. Actions include being able to render key parts of the virtual patient. Responsibilities are to execute the anaesthetising procedure. Actions include being able to execute all of the steps in anaesthetising the patient. Responsibilities are: (1) to provide a physical model of the abdomen for the procedure, and (2) to maintain the location and state of the trauma including types of uid that may be retrieved from certain areas, and the site for the incision and the state of the patient. Responsibilities are to be a model of the incision. Responsibilities are to be a model of the fascia. Actions are to test if the fascia has been penetrated or not. Responsibilities are to be a model of the bowel. Actions are to test if the bowel has been penetrated or not. Responsibilities are to be a model of the scalpel. Responsibilities are to be a model of the cannula. Actions are to insert and remove the cannula. Responsibilities are to be a model of the guide-wire. Actions are to insert and remove the guide-wire. Responsibilities are to be a model of the catheter. Actions are to insert and remove the catheter. Responsibilities are to be a model of the syringe. Actions are to attach the syringe to the catheter, to extract uid and to remove the syringe. Responsibilities are: (1) to store signicant events and actions of the surgeon for later replay; and (2) to save the state of a procedure for resuming it later. Actions are to store events, store the state of the procedure and keep details of the current students performance. Responsibilities are unclear.
73
+Event List +Operation State +Patient Model +Record Event() +Record Procedure State() +Record Patient Model()
Engaged in 1 Student Record of Actions History of 1Procedure m 1 +Name +Procedure State +Load Patient() 1 Uses
Scalpel
+Render Scalpel()
1 Make Incision m
Abdominal Wall
Cannula
+Insertion Depth +Insert Cannula(Length:Real) +Remove Cannula() +Render Cannula() 1
Inserted Into
+Incision Site +Render Abdominal Wall() +Render Incision() 1 +Render Trauma() 1 +Select Incision Site() +Make Incision()
Inserted Into
Guidewire
+Guide Wire State +Insert Guidewire(Length:Real) +Render Guidewire() +Remove Guidewire() Inserted Into 1
Incision
+Incision Length +Incision Depth
Fascia
+Render Fascia() +Fascia Penetrated(): Boolean
Bowel
+Render Bowel() +Bowel Penetrated(): Boolean
Catheter
+Render Catheter() +Insert Catheter(Length:Real) +Remove Catheter() Attached To
Syringe
+Volume of Fluid +Render Syringe() +Attach Syringe() +Extract Fluid() +Remove Syringe()
Asking Questions!
Of course we are note nished yet! The Execute DPL Scenario needs to be lled and we are uncertain about a number of areas that our modelling has highlighted. 1. In recording events, and actions in the Recording phase, what tasks and actions are signicant? Are there standardised assessment tasks for medical students? 2. Our understanding of the Local Anaesthetic object is poor. What is the procedure for administering a local anaesthetic? 3. There is no closing procedure. What is the process for closing? 4. Is our model of the syringe correct or do we need another association? Where does the uid need to go in order to get tested? 5. The use case does not provide a good data model for students, administrators, or supervising /educating surgeons. What are their roles in th system and what information will they need? The act of trying to create a model, assign responsibilities and determine relationships can help immensely in understanding and clarifying situations. By going through each object and trying to verify it and its responsibilities against the use case we can derive at least the questions above and probably many more. Answers to such questions will ultimately help to create a lled use case.
74
75
76
:ATM
:Central Computer
Bank Computer
Figure 5.16: A sequence diagram for the ATM example. Sequence diagrams describe how objects and actors collaborate to achieve the tasks of the system. Sequence diagrams specically show a time-ordered sequence of events and messages that are sent between objects, and between objects and actors. Objects and actors are listed across the top of the diagram. We can include: actors, 77
specic objects, for example, customerA : CUSTOMER, and an anonimous object which satises a type declaration : CUSTOMER. Messages and events are represented by the operation calls in the objects that are listed at the top of the diagram and the time ordering of messages is represented by the vertical placement down the page; later calls are further down the vertical line. The head of the arrow determines which object owns the operation and the tail of the object determines which object invokes the operation. For example, accept card() is an operation in the ATM class and is invoked by the Customer actor. A second form of diagram which expresses the ways in which objects interact to produce behaviours is the Collaboration Diagram. The collaboration diagram corresponding to the sequence diagram in Figure 5.16 is given in Figure 5.17. .
Customer Bank Computer
9. accept_trans()
1. accept_card() 2. accept_pin()
7. valid_user()
Figure 5.17: A Collaboration Diagram Collaboration diagrams are intended to emphasise the organisation and relationships between objects in a collaboration, while sequence diagrams are intended to emphasis the time-ordering of messages. In collaboration diagrams the time ordering of sequences of messages (modelling events and actions) are specied with sequence numbers with the direction of the message given by the arrows. To show nesting you use multi-level numbers. The lines represent relationships, or links, between object. Both the sequence diagram and the collaboration diagram derive the same information but the presentation emphasises different aspects of this information. The diagrams are, however, semantically equivalent and each diagram can be derived from the other.
The focus, or level of abstraction, will dictate the objects, actors and messages involved in the collaboration diagram. You will need to decide if it is more important to focus on the structure of the interaction and nested sequences of messages (in which case use a collaboration diagram) or the time ordering of messages (in which case use a sequence diagram).
Trainee Surgeon
: Procedure
: Abdominal Wall
Make Incision()
Figure 5.18: A sequence diagram for making an incision. The second sequence diagram in Figure 5.19 shows up some problems with the model, but it is arguable if there is a problem with the use case. Again, the trainee surgeon must choose to insert a cannula (Select Cannula Insertion()), but in addition some information must pass between the Cannula and the Abdominal Wall objects. The state of the procedure must be altered to reect the fact that the cannula is being inserted. Inserting a cannula is, effectively, a continuous operation requiring that the simulation reect the visible and hidden parts of the cannula4 as it enters the abdominal wall.
If haptic interaction is being contemplated, then the forces acting against the cannula also need to be taken into account.
4
79
Trainee Surgeon
:Cannula
:Abdominal Wall
Select Cannula Insertion() Insert Cannula( length ) Update Abdominal Wall() Render Cannula()
80
Loose Control of Guidewire Load a Patient Patient Loaded Insert Catheter Catheter Inserted Insert Catheter Insert Catheter
Making an Incision
Cannula Removed Catheter Inserted Guidewrire Removed Remove Cannula Attach Syringe
Guidewire at End of Cannula Inert Cannula into Incision Cannula Inserted Penetrate Fascia Cannula Inserted to Correct Depth Insert Guidewire Guidewire Inserted Insert Guidewire Insert Guidewire Make Diagnosis Inert Cannula into Incision Syringe Attached
Inserting Guidewrire
Aspirate Blood
Loose control of Guidewire Lost Control of Guidewrire Extract Guidewire Regain Control of Guidewrire
Correct Diagnosis
Make Diagnosis
Figure 5.20: A possible state chart for the Diagnostic Peritoneal Lavage procedure.
81
Start State
Select Site
Develop Plan
[Else]
Do Site Work
Do Trade Work()
Finish Construction
Concurrent Join
82
Activity diagrams consist of Activities, which are non-atomic actions in some state machine. We can think of activities as representing an action made up of a sequence of atomic computations. Branches which consist of guards which allow ow of control to pass along the arc associated with the guard. Parallel sets of activities which are signied by the concurrent fork and the concurrent join. The concurrent fork enables a number of parallel threads of control to be initiated, while the concurrent join brings the parallel threads back together again into a single thread of control. When the sequence of steps corresponding to an activity nishes then the ow of control passes immediately to the next activity state (and the rst atomic action in that activity). Branching is possible as well (diamond box) where the ow of control has a choice of passing along a number of arcs. The arcs are guarded by expressions; if the expression is true then ow of control can pass along that arc. Finally, we can have concurrent threads of control signied by the fork/join lines. The ow of control is essentially split by a fork line and both sequences of activities execute in parallel until they are joined together again by a join line. Note a join line need not join together all the threads of control.
83
84
85
A good SRS makes it easier to transfer the software product to new users or new machines. A good SRS serves as a basis for corrective maintenance and for enhancements to the software. A good SRS will discuss the product developed but not the processes or the project used to develop the software1 . The SRS serves as the basis for enhancing the nished product. In so doing the SRS may need to be altered but at least it provides a rm foundation for enhancement and maintenance as well as providing a good starting point.
SRS Templates
Requirements can be specied using natural language, diagrams or using formal methods. Ideally, the aim of the requirements document is to convey an understanding of the problem, the problem domain, and what the system needs to produce, provide, transform or accomplish in order to satisfy the clients needs in solving their problem. As a guide to the contents of an SRS we can look to the IEEE standard IEEE Std. 830-1998 [?]. Figure 6.1 and Figure 6.2, Figure 6.3, Figure 6.4 and Figure 6.5 give a series of suggested templates for setting out the Software Requirements Specication. Table of Contents 1. Introduction 1.1 Purpose 1.2 Scope 1.3 Denitions, acronyms, and abbreviations 1.4 References 1.5 Overview 2. Overall Description of the Proposed System 2.1 System Context and Perspective 2.2 System Functions 2.3 User Characteristics 2.4 Constraints 2.5 Assumptions and Dependencies 3. Specic Requirements Appendixes Index
Figure 6.1: A Template for the Software Requirements Specication: Adapted from IEEE Std. 8301998
87
3. Specic Requirements 3.1 External Interface Requirements 3.1.1 User Interfaces 3.1.2 Hardware Interfaces 3.1.3 Software Interfaces 3.1.4 Communications Interfaces 3.2 Functional Requirements 3.2.1 Functional Requirement 1 . . . 3.2.N Functional requirement N 3.3 Performance Requirements 3.4 Design Constraints 3.5 Software System Attributes 3.6 Other Requirements
Figure 6.2: Section 3 of the Software Requirements Specication Organised According to Requirements Class: Adapted from IEEE Std. 830-1998 3. Specic Requirements 3.1 External Interface Requirements 3.1.1 User Interfaces 3.1.2 Hardware Interfaces 3.1.3 Software interfaces 3.1.4 Communications Interfaces 3.2 Functional Requirements 3.2.1 Mode 1 3.2.1.1 Functional Requirement 1.1 . . . 3.2.1.N Functional Requirement 1.N 3.2.2 Mode 2 . . . 3.2.m Mode M 3.2.M.1 Functional Requirement M.1 . . . 3.2.M.N Functional requirement M.N 3.3 Performance Requirements 3.4 Design Constraints 3.5 Software System Attributes 3.6 Other requirements
Figure 6.3: Section 3 of the Software Requirements Specication Organised According to System Modes: Adapted from IEEE Std. 830-1998 88
3. Specic Requirements 3.1 External Interface Requirements 3.1.1 User interfaces 3.1.2 Hardware interfaces 3.1.3 Software interfaces 3.1.4 Communications interfaces 3.2 Classes/Objects 3.2.1 Class/Object 1 3.2.1.1 Attributes (direct or inherited) 3.2.1.1.1 Attribute 1 . . . 3.2.1.1.N Attribute N 3.2.1.2 Functions (services, methods, direct or inherited) 3.2.1.2.1 Functional requirement 1.1 . . . 3.2.1.2.M Functional requirement 1.M 3.2.1.3 Messages (communications received or sent) 3.2.2 Class/Object 2 . . . 3.2.P Class/Object P 3.3 Performance Requirements 3.4 Design Constraints 3.5 Software System Attributes 3.6 Other Requirements
Figure 6.4: Section 3 of the Software Requirements Specication Organised According to Objects: Adapted from IEEE Std. 830-1998.
89
3. Specic Requirements 3.1 External Interface Requirements 3.1.1 User interfaces 3.1.2 Hardware interfaces 3.1.3 Software interfaces 3.1.4 Communications interfaces 3.2 Use Cases 3.2.1 Use Case 1 3.2.2 Use Case 2 . . . 3.2.N Use case N 3.3 Performance Requirements 3.4 Design Constraints 3.5 Software System Attributes 3.6 Other Requirements
Figure 6.5: Section 3 of the Software Requirements Specication Organised According to Use Cases: Adapted from IEEE Std. 830-1998. need to be tailored to the individual project. Standard formats such as those in [20] are not suitable for all projects and you may well need to add extra sections or substitute sections in order to make a template relevant to your project. The key thing to remember is that at the start of the SRS you need to state clearly what deviations from the standard you have employed for your requirements document. Once the requirements are written according to the format in the IEEE Standard IEEE Recommended Practice for Software Requirements Specications (IEEE Std-830-1993) it recommends that the SRS exhibit the following eight properties. 1. Correctness The correctness of requirements typically refers to the accuracy of the requirements and whether or not, a system which implements these requirements will actually meet the clients needs (rather than just the clients desires). Each requirement needs to be checked that it is accurate, transforms, produces, accomplishes or provides exactly what is required for a solution to the clients problem and is feasible in terms of the ability to implement that requirement in the time given for the project. 2. Completeness Completeness in refers to (1) the completeness of the requirements, that is, do we have all of the requirements necessary to describe the solution to the clients problem; and (2) does the SRS contain all of the gures, tables and diagrams necessary to explain all of the requirements. 3. Consistency Consistency refers to (1) the logical consistency of the requirements, that is, no two requirements in the SRS are in conict over what the system must accomplish, transform, produce, or provide; and (2) that the terminology, diagrams, tables and gures are consistent, use the same terminology and provide a consistent view of the proposed system. 90
4. Veriability Veriability refers to the ability to write down a procedure to test the correctness of each requirement in the implementation. 5. Prioritorisation Each requirement should have a priority set on it so that there is a clear indication of which requirements should be tackled rst, and which requirements are less important. 6. Traceability Traceability refers to the ability to trace modules in the implementation back to requirements (Forwards Traceability) and to trace requirements back to their source (Backwards Traceability). Requirements ought to be numbered for ease of traceability. 7. Modiability The dependencies between requirements ought to be such that modifying the requirements is easy, and that tracking the effect of changes is easy. Note that tools such as requirements databases and conguration management tools help to track changes, but the key point is that a changes to requirements need to be carefully monitored and that the structure and layout of the SRS should make tracking the effects of changes more manageable. 8. Unambiguous Ideally, requirements should only be interpreted in one way and not be open to multiple interpretations. If multiple interpretations are possible then we open up the possibility of implementing the requirement in a faulty way. Requirements should be written clearly, concisely and as unambiguously as the language or notation will allow (see the list of phrases in the English language to avoid).
5. Beware of vague verbs, e.g. handled, rejected, processed, eliminated or skipped. These can be interpreted in a number of ways and should be replaced by more denite processes. 6. Beware of dangling pronouns, e.g. The I/O module communicates with the data validation module and its control ag is set. Whose control ag is set? 7. Look for statements that imply certainty, e.g. always, every, none, never. Check these and ask for proof if necessary. 8. When a term is explicitly dened try substituting the denition in a couple of places that the term is used. 9. When a structure or object is described in words draw a picture to aid in understanding it. 10. When a calculation is specied try at least two examples. Beware of writing requirements using vague terms and language. Here are some examples of requirements that use vague terms and language. The system must respond to user commands in a reasonable time. The application is to have a Motif style user interface. The server will be sufciently fast so that it is not the limiting factor in the speed of the system. The user interface should be intuitive. The system must be able to deal with other real world constraints. Also beware of writing ill dened requirements. Here are some examples of ill dened requirements. The system will be initialised by, 1. calibrating the subsystem A, and 2. calibrating the subsystem B. Assuming that we know what subsystem A and B are (from the SRS) then we still do not know what constitutes a calibration of the system. To ensure that this requirement is not ill dened then we need to state exactly what it means to calibrate each of the two subsystems. Another example of an ill-dened requirement is the following. The data-base will allow the user to access and alter parts of the data base. The database will contain parts. Associated with each part will be the data specic to this part. Assuming that we already know what parts will be stored in the database some indication is needed of what data associated with parts needs to be stored. A better way of writing this requirement may be the following. The database will contain parts. Associated with each part the database needs to store the part number in Company X format (see 5.3.2.1), the quantity and . . . 92
Formal Methods
Another way of specifying requirements is to use a very precise mathematical notation. Such notations are called Formal Methods and typically provide more than just a notation for writing down requirements. They often include tools of analysis, especially for concurrent systems and their behaviour. A short list of some of the more established formal methods is given in Figure 6.6. Model Based Z VDM B ACT I ACT II Extended ML CCS CSP LOTOS ESTELLE Petri Nets Figure 6.6: A short list of formal methods A mathematical notation provides a precise language, without the ambiguities of natural language. Essentially, there are three main groups of formal methods, which we class as model based, axiomatic and process algebra. In addition, for concurrency and resource usage, petri nets are an old reliable favourite in many engineering disciplines. While this subject is not about formal methods Figure 6.7 and Figure 6.8 give a brief idea of the kinds of notations and styles that are involved. Figure 6.7 shows the specication in Z of a simple dependency management system, or in other words a system to manage directed acyclic graphs. Each of the boxes is called a schema, and schemas contain both state variables and predicates specifying how the state variables change. The specication in Figure 6.7 is parameterised by a set of data (Given by [DATA] and the system state is given by the schema DepManSys. The system also has four operations AddNode, RemoveNode, AddDependency, and RemoveDependency. Notice that the style is to represent the state of all of the operations explicitly as sets, and all changes in state as predicates over the current state. Do we involve implementation bias in this case? Contrast the Z specication with the process algebra expression in Figure 6.8. CCS is a language for modelling concurrent systems where each expression denes a Process. All we know about processes are that you can observe a process engage in an action, and that the actions that are observable dene the process behaviour. In the example in Figure 6.8 the actions for the Producer process are pc 1 and pc2 . The bar over action signies that it is an output of the Producer process. Unbarred actions are inputs. In the case that a process has a barred action with the same name as an unbarred action in another process, then the two processes can synchronise and exchange data. 93
Axiomatic
Process Algebra
Concurrency
[DATA] DepManSys nodes : F DATA ddo, tc : DATA DATA ddo nodes nodes tc = ddo+ ( x : DATA (x, x) tc) AddNode DepManSys d? : DATA d? nodes / nodes = nodes {d?} ddo = ddo RemoveNode DepManSys d? : DATA d? nodes \ ran ddo nodes = nodes \ {d?} ddo = {d?} ddo
AddDependency DepManSys x?, y? : DATA {x?, y?} nodes x? = y? ddo = ddo {(x?, y?)} nodes = nodes
RemoveDependency DepManSys x?, y? : DATA (x?, y?) ddo ddo = ddo \ {(x?, y?)} nodes = nodes
Producer = pc1 .Producer + pc2 .Producer Consumer = cc1 .Consumer + cc2 .Consumer Channel = pc1 .pc2 .cc1 .cc2 .Channel Figure 6.8: A portion of a CCS specication for a producer/consumer system.
(6.1)
94
95
1. verify that the SRS satises the correctness, completeness and consistency criteria as well as the other eight aspects of a good SRS;verify that work products satisfy their specications; 2. verify that the SRS conforms to standards; 3. identify deviations from standards and the goals of a good SRS (these are identied as defects and are listed); 4. collect data, for example, the number of defects found; 5. inspections do not, however, examine alternatives or stylistic issues or seek to improve the SRS. Walkthroughs focus on objects; the main objective is to understand the work product in order to nd defects, omissions and contradictions as well as alternatives which improve the software product.
Prototyping Approaches
There are several approaches to prototyping that are commonly used. 1. Throw-away 2. Evolutionary 3. Incremental In throw-away prototyping we construct a prototype explicitly for the purpose of eliciting, understanding and validating requirements. A process for rening requirements using prototyping is given in Figure 6.9.
Requirements Analysis
Develop Prototype
Modify
Evaluation Successful
Unsuccessful
Figure 6.9: A throw-away prototyping process. We list the advantages and disadvantages of throw-away prototypes below. The advantages are: 1. The prototype can be exercised in order to uncover erroneous behaviour. 2. The prototype can be used as a common basis for communication between clients and developers in order to reduce the risk of misunderstandings. 3. Missing requirements may be detected. 4. Difcult or confusing services may be uncovered, especially if end-users are involved with the prototype. But beware prototypes are not always built with usability in mind! 97
5. Demonstrate feasibility of requirements and reuse useful design decisions. Remark 6.1 There is a key assumption here and that is that the prototype is a faithful implementation of the requirements. The disadvantages of throw-away prototypes are: 1. We must determine if a defect is a defect of the requirements or the prototype. In other words how far can we trust our assumption that the prototype faithfully implements the requirements. 2. Unless, carefully managed the prototyping process can consume the available time (and resources). 3. Clients, after seeing many of the features that they want, may insist on the prototype rather than the production version and may not want to pay for the production version! Remember: A prototype is not a production version of the software! There are some very good reasons for this. The prototype often does not encompass all of the functionality that the production version needs to have. Prototypes, because of the speed with which they are typically built, are not maintainable. Throw-away prototypes in particular have been built for the purpose of eliciting requirements using prototyping tools. They do not typically exhibit the kind of properties, like performance, required of production models In the evolutionary approach the process begins by gathering requirements, building a prototype and then iterating until an acceptable production version is reached. The key problems with evolutionary prototyping are the following. 1. Typically, prototype evolution is so rapid that no design rationale is kept. Consequently, the prototype very quickly becomes unmaintainable. 2. It is extremely difcult to follow any standards during evolutionary prototyping. 3. Project planning becomes impossible if there is no schedule of deliverables or discipline applied to the prototyping. 4. Prototyping, evaluation and subsequent improvement can become never-ending. 5. There is always a signicant risk that the prototype being evaluated is out of date thus making the evaluation inaccurate or meaningless. 6. Proper documentation is very difcult to produce in very short cycle times. Incremental development combines the evolutionary approach with the discipline more traditional software development. It relies on building up requirements and delivering the system in an incremental fashion. 1. Maintains the discipline of planning and managing each increment. 98
2. Documentation can be produced and standards followed. 3. Allows for user feedback. But incremental prototyping also has its problems. 4. integration may be difcult, 5. design must be done early, 6. relies on isolating a well understood set of core requirements. A generic incremental prototyping process may appear as in Figure 6.10.
Requirements Design Code Test Integrate Maintain
Design
Code
Test
Integrate Maintain
99
(i) An artifact is unsafe if it causes unacceptable harm or damage; in terms of loss of life, in terms of environmental damage, in terms of loss of livelihood or extreme nancial loss. Note that weapons cause harm but it is unacceptable if it harms the wrong people. Banking normally requires that systems be secure but if those very same systems can cause irrevocable loss of funds then it is a hazard. (ii) We will assume that only physical systems can cause harm of this kind 1 (iii) Software only has the capacity to cause this kind of harm indirectly. Safety is typically considered from the perspective of a platform. A platform is typically the largest engineered artifact incorporating the system being developed. What we wish to avoid in
Platform Largescale artefact, e.g, oil and gas platform, aircraft, car.
Figure 7.1: A generic view of a platform. engineering and operating our platform is accidents. The system that we build must avoid the hazards that lead to accidents. Denition 7.1 (i) An Accident is an event or sequence of events leading to harm, that is, death, injury, environmental damage, or nancial loss. (ii) A Hazard is a physical situation or state of the platform that can lead to an accident.
If we include loss of livelihood or extreme nancial loss then perhaps we are not really talking about physical systems anymore. There is an issue of whether such loss, caused electronically is the province of security or safety or both.
1
101
To understand the safety of a system and its subsystems, we must also understand how they can fail! To do this it is common to investigate accidents and accident sequences, that is, to understand the sequence of events leading to the accident and to try and determine which subsystems failed. It is important to realize here that accidents are not caused by a single events or single failures. Other domains such as avionics have shown us that accidents are usually caused by combinations of failures and or circumstances (see the Okecie Accident below). Remark 7.1 1. Hazards are really accidents waiting to happen. They are the preconditions for an accident. 2. In hazard identication we are concerned with thinking about the safety of the personnel or the platform. We often need to start from known accidents or consider possible accidents and work back to hazards. This is very much a brainstorming exercise. 3. We can also think of Hazards as conditions of the platform that, unless mitigated, can develop into an accident through a sequence of normal events and actions.
102
1. Requirements Analysis and Product Denition During the early stages of development exploratory analyses in the form a Preliminary Hazard Analysis (PHA) and other methods are used to determine the hazards, potential situations that can cause harm or environmental damage and their potential causes are listed. The intention is that we have a good understanding of the safety aspects of the systems prior to going into the design and implementation phases. 2. Design and Implementation Phases Two different kinds of techniques are used to rst guide the design and implementation and then secondly to verify that it does not lead to situations with the potential for harm or damage. To guide the design a deductive approach (one that starts with potential situations of harm or injury and works back to design or implementation elements) is used and this is typically followed up by an inductive approach (one that starts from component or subsystem failures and works back through sub-systems to see if hazards result is used to verify the safety elements in the design. 3. Defending in Depth Systems that must defend against situations of harm or damage must typically be ultra-reliable or there must be sufcient redundancy so that a safety related subsystem failure does not lead to a safety related system failure. This is the principle of Defending in Depth against potential accidents. 4. Building up Safety Cases Safety cases are the high level arguments that are presented to regulatory bodies, or customers that your system is safe. They are generally built up using all of the evidence gathered during the exploratory, deductive, inductive and design processes.
Flaw Flaws are design defects or programming defects that give rise to errors when certain conditions are activated. Fault Faults are the events that result when a aw is activated. Remark 7.2 1. Failure, especially in safety critical systems, is with respect to intention and not with respect to specication as in more orthodox denitions of reliability. 2. Failures are properties of the execution of a program and must typically be observed in order to be detected. Errors and aws are properties of the systems within the platform and their function. Flaws are properties of the system. 3. The denition of failure given here is very general: it includes failures such as deviations from required response times, inaccurate of results including instability in numerical algorithms or poor precision leading to round-off errors, security that can be subverted, mean-time to failure below that required and other factors. 4. The usual process of testing and identifying failures, errors and determining the faults and aws that lead to these errors. 5. Most accidents are the result of multiple system failures at a number of levels, and often including operator error, mechanical, electrical and software errors. Systematic and Random Failures It is normal to consider design aws and random failures separately in requirements and in design. We also have the following classication of failures. Systematic Failures are due to design or requirements aws. Typically the requirements for systematic aws are given in terms of integrity levels (see below) for subsystems. Random (or Stochastic) Failures are due to physical processes or factors in the environment. Random failures are usually specied in terms of failure rates.
Figure 7.2: The Okecie accident. strong winds veered from a cross-wind to a tail-wind on nal approach, and it was raining heavily. Further air trafc control (ATC) did not inform the aircrafts crew of the change in wind direction. The result was that the pilot had banked into what was believed to be a cross-wind on nal approach. The runway also had standing water on it which resulted in the aircraft aqua-planing after it landed.
At time T=0sec the airframe was at ground but the braking logic failed to detect this.
Figure 7.3: The attitude of the A320 on landing. The runway was probably built outside normal specications. The braking systems of the A320 are sketched in Figure 7.4. The logic appears as follows. AG is true if ((WoW 12 tonnes) and wheels spinning grt 72 km/hr) or (wheels spinning 72 km/hr and radio alt 10ft) whereAG means At Ground, and WoW means Weight on Wheels. Note that weight on wheels is a function of both wheels and not just an individual wheel. The standing water on the runway caused th aircraft to aqua-plane while braking and consequently the wheels were not spinning at the required rate to activate the braking logic. Thus we had, AG = False (weight on both wheels), WS = False (wheels spinning at 72 km/hr), 105
SEC
Spolier and Elevators
Altimeter
EFCS
Flight Control
Alt.
Pilot Interface
Figure 7.4: The braking systems of the A320 airbus The logic was implemented correctly but the system failed. The LGCIU and its related systems failed against intent. The operators and in particular the air-crew may have failed in this particular instance but there is no manual override in some modes of the EFCS. Overall, this is quite probably a failure in requirements but the situation is perhaps not a very credible one. Further, we can isolate the error, aw and fault which lead to the accident The error which caused the accident was the assignment AG = False, The aw leading to the error in the circumstance of the accident was that we required AG = WoW 12tonnes for both wheels2 . The failure arose because the aw was triggered in condition of wind and water on the runway. Remark 7.3 (i) Typically accidents arise from multiple failures rather than just single failures. This is why studying accidents and their causes is important. We must correct or avoid the circumstances of the accident if we are to develop safe systems. (ii) Failures occur with respect to intent, not necessarily with respect to the specication. In fact, many such failures result from not getting the requirements correct in the rst place. (iii) Causal analysis is complex because of the potential interactions of the system with its environment. Further, apportioning responsibility for accidents is rarely straight-forward and thus making it harder to judge the contribution of the systems involved to the accident. (iv) In aerospace, pilots are often blamed but the systems are usually a key factor in accidents.
2
But note that it is arguable whether or not this is really a aw because the situation is not very credible.
106
Design
System
Subsystems Units
Implementation
Figure 7.5: The V model for a system development process. for the system, followed by design and a decomposition of the system into hardware and software components. It is usually at this stage that software requirements phases occur since the software must work with the hardware to achieve the functions of the system. Superimposed on the system development life-cycle is the safety life-cycle. The safety life-cycle consists of a number of activities which are aimed at determining and verifying the safety functions of the system. We begin in Figure 7.6 with the initial hazard list which is the list of known hazards in
Initial Hazard List Hazard Identification Causal Analysis Consequence Analysis Implementation Causal Analysis Overall System
Figure 7.6: Safety analyses superimposed on the V system development model. the domain or a list of hazards obtained from similar systems or prior versions of the current system. We then go through a Preliminary Hazard Analysis (PHA) for the new system followed by the relevant consequence and causal analyses for the system. Preliminary Hazard Analysis is aimed at determining potential hazards for the new system as well 107
as the causes of failure leading to these hazards and the likelihood of such failures. It includes the Preliminary Hazard Identication phase. Consequence Analysis (inductive analysis) is typically performed bottom up, that is, we work from design elements to hazards. Consequence analysis together with causal analysis is predicative and often carried out before the design is completed. It is used to provide information into the design processes and is aimed at choosing between design alternatives. Some inductive methods for consequence analysis are Event Trees, Failure Modes and Effects Analysis (FMEA) and Zonal Hazard Analysis (ZHA). Causal Analysis (deductive analysis) is typically performed top-down working from hazards to design or model elements. Fault trees are the classic deductive analysis method and Hazard and Operability Studies (HAZOP) is also common. We have listed some inductive and deductive methods above but in practice there are over 90 different analysis methods that have been suggested in the literature. We will not be covering them all! Finally, there is a safety case that needs to be built up during the development process. A safety case is a clear, comprehensible and defensible argument that a platform will be acceptably safe throughout its life and decommissioning. Safety cases are required for the justication or certication of any safety-critical or safety-related system, facility or operation.
Initial Hazard List Safety Case
Implementation
Figure 7.7: Safety cases superimposed on the V system development model. In summary, the life-cycles require that: determine what we mean by safe for the platform hazard identication and consequence analysis; design the platform so that it is safe using hazard identication and causal analysis; show that the platform is safe produce a safety case.
108
Incident Data PHA Hazard Data Analyses Analysis of similar systems or prior versions of the same system. Preliminary Hazard List
Figure 7.8: Preliminary Hazard Analysis: Essentially a collating and ltering exercise. a PHA are the prior incident data for systems similar to the new system, Hazard data and previous analyses. The output is a preliminary hazard log. For example, a preliminary hazard analysis may be summarised in the following hazard log. Methods PHA is a group based activity where safety related design difculties and hazards are postulated. Usually conducted either Informally using brainstorming; Formally using some of the graphical or tabular methods. Checklists are commonly used for ensuring completeness. The group tries to pin down which aspects of the system will cause trouble. It is common to ask what if questions. Output An initial Hazard Log (see Table 7.1).
Inputs
The inputs required for a Preliminary Hazard Analysis (PHA) are: 109
Prior incident data for systems similar to the new system, Hazard data, and Previous analyses.
Methods
PHA is a group based activity where safety related design difculties and hazards are postulated. Usually conducted either: Informally - using brainstorming; or Formally - using some of the graphical or tabular methods. Preliminary Hazard Analysis relies very heavily on experience, knowledge of previous systems and on ensuring that experts from all of the relevant disciplines are present. Checklists and questionnaires are commonly used for ensuring completeness. The group tries to pin down which aspects of the system will cause trouble. It is common to ask what if questions and take notes for later analysis including possible event sequences leading to accidents, system causes and other factors such as human factors. One approach, that is taken by the High Integrity Systems group at the University of York, partitions the PHA into three areas. Functional Failure Analysis: considers the consequences of the failure of each of the identiable system functions. Examples include, Failure to actuate brakes when a force is applied to the brake. Operational and Support Hazard Analysis: consider the tasks and interaction of the personnel with the system. Examples include: Burns from equipment, electrocution; Faulty equipment resulting in a failure to complete a task for example, dispatching an ambulance to a code red. Occupational Health Hazard Analysis: considers harm to personnel caused by the functioning of the system. Examples include Electrical, chemical or heat burns, or physical injury from the movement of parts.
110
Ref.
Outputs
The output of a PHA is: Preliminary hazard log; and A set of safety requirements. A preliminary hazard log can be summarised as in the following table. The second output is a set of safety requirements for the system. Safety requirements are those requirements stemming from the PHA and other safety analyses that: Are related to systems or subsystems that must mitigate hazards, or lessen their effect; or Are related to the integrity levels of failure rates of safety related subsystems. Remark 7.4 1. Note that our example hazard log contains a column for the current risk class and a column for the integrity level. It is important to distinguish these concepts. Risk measures the likelihood of a hazard of a certain severity occurring and is a property of a hazard in a given environment. Safety integrity refers to the amount of risk reduction required of a safety related system used to mitigate the effects of the hazard or reduce its likelihood. In general, the higher the integrity level of the safety related system, the greater the amount of risk reduction it is responsible for. 2. Risk classes are calculated from the severity and likelihood of the hazards identied. Standards like IEC1508 provide tables for the qualitative assessment of risk. Quantitative risk assessment is also possible provided that the reliability of all components including software is known. The problem here is that reliability estimates for software components cannot usually be estimated so early in a project.
Frequent Probable Occasional Remote Improbable Incredible. Part of the problem of PHA is to assign meaningful measures to these classes so that hazards are interpreted consistently. In AS4048.1 and IEC65A the Risk Class is then given by Table 7.2. The interpretation of risk Frequency Consequence Catastrophic Critical Marginal Negligible Frequent I I I II Probable I I II III Occasional I II III III Remote II III III IV Incredible IV IV IV IV Table 7.2: Risk classes according to IEC65A which was a predecessor of IEC1508. classes according to IEC65A is given in Table 7.3. Class I Class II Class III Class IV Intolerable risk Undesirable risk and tolerable only if risk reduction is impractical. Tolerable risk if the cost of risk reduction would exceed the improvement gained. Negligible risk.
Causal
Consequence
Good For . . . Exploring possible hazards, their causes and for completeness, but is very labour intensive and hard to change. Fault Trees This is the classic deductive approach and is good for determining what combinations of component failures lead to hazards. FMEA (Failure Modes This is the classical inductive approach and Effects Analysis) used for working from component failures (failure modes) back to hazards and is good for verifying ideas and designs. Table 7.4: Types of Hazard Analysis Methods.
Ensuring follow-up work is completed. Recorder who is responsible for: Documenting the analysis; Participating in the study. Designers Understand and explain the (potential) design; Answer questions about the process. User(s) who may be an operator, or representative of other user groups such as maintainers of the system; Supply information about the context in which the system will be used; Help decide issues that may affect safety. Expert(s) The key function of experts is to Explore Ask questions; Suggest deviations, causes and effects. HAZOP uses guide words to consider the effects and causes of system failures of various kinds. The guide-words in Table 7.5 are taken form MoD 0058 and are for use with software HAZOPs.
113
Deviation This is the complete negation of the design intention. No part of the intention is achieved and nothing else happens. This is a quantitative increase. This is a quantitative decrease. All the design intention is achieved together with additions. Only some of the design intention is achieved. The logical opposite of the intention is achieved. Complete substitution, where no part of the original intention is achieved but something quite different happens. Something happens earlier than expected relative to clock time. Something happens later than expected relative to clock time. Something happens before it is expected, relating to order or sequence. Something happens after it is expected, relating to order or sequence. Table 7.5: Guidewords for Software HAZOPs
114
Undeveloped Event An event which is not developed further, either because it is considered unnecessary or because insuficient information is available. Intermediate Event An event arising from the combination of other, more basic events.
Normal Event An event which is expected to occur as part of the normal operation of the system. Conditioning Event Specific restrictions that apply to some types of logic gates, for example the PRIORITY AND or INHIBIT gates.
AND gate All of the inputs must occur for the output to occur
OR gate One or more of the input events must occur for the output to occur
PRIORITY AND gate The output occurs if the input events occur in a specific sequence which is described in a conditioning event.
EXCLUSIVE OR gate The output occurs if exactly one of the input events occurs.
INHIBIT gate The output occurs if the single input event occurs in the presence of the enabling condition which is described in the conditioning event.
Figure 7.10: Fault tree gate symbols. Basic Event requires no further decomposition. Compound Defect which may one of (1) a primary failure which is a simple component failure and may be classied as a basic event, or (2) a secondary failure in which components fail because of external inuences and this usually requires further investigation, or (3) command failure in which components receive incorrect signals and this always requires further investigation. System Defect which is not attributable to a single component and always requires further investigation. 4. Repeat as required! There are some further heuristics, which have evolved over time, for the correct construction of fault trees. 1. All inputs to a gate should be dened before any one is examined in more detail. 2. The output of a gate must never be directly linked to the input of another gate all outputs of gates must go to events. 116
Tank overflows
B Controller
Valve A Closed
Valve B open
Controller Failed
Sensor X Failed
Sensor Y Faield
Figure 7.11: Fault tree example: chemical mixing. 3. The text in event boxes should be complete in the sense that they should always say what the event is and when it occurs. 4. Causes always chronologically precede consequences. Consider the simple chemical mixing plant shown in Figure 7.11 and its accompanying fault tree [12]. The top-level event which leads to a hazard in this case is that the tank may overow and cause environmental damage. The immediate, necessary and sufcient causes of this event are that the valve marked A is closed and that the valve marked B is open. Note that these events must occur before the tank overows. The fault tree does not investigate the causes of the event valve A closed further. On the other hand valve B is open if valve B has failed, which is a component failure but is not investigated further, or an incorrect signal has been sent to valve B, which is a command failure and must be investigated further.
(ii) An assessment of the Current Risk of the hazard and the Target Risk. (iii) Causal analyses indicating which system components can potentially lead to hazards if they fail. Next, we need to understand Safety Integrity. Safety integrity is the likelihood of a safety related system satisfactorily performing the required safety functions under all stated conditions. For example, a standard with known failure rates for subsystems; Integrity Probability of failure to Level perform system function 4 105 to < 104 3 104 to < 103 2 103 to < 102 1 102 to < 101 Note: the distinction between risk classes and integrity levels. Risk classes are assigned to hazards. Integrity levels are assigned to systems. It is not always possible to remove hazards entirely. It is the task of safety related systems must reduce hazard risks to tolerable risk levels which is why target risk assessments are important. The amount of risk reduction that is required to reduce the assessed risk to the target risk determines the integrity level. The more that the system is required to reduce the risk of hazards the higher the systems integrity level. Note that there are a number of ways of assigning integrity levels to subsystems. Quantitative methods rst determine the uncontrolled risk and then target risk levels numerically, by analysing the failure rates of subsystems from similar situations; Qualitative methods use risk graphs to determine risk qualitatively.
119
Bibliography
[1] W. Bischofberger and G. Pomberger. Prototyping-Oriented Software Development: Concepts and Tools. Texts and Monographs in Computer Science. Springer-Verlag, 1992. [2] B. Boehm. A spiral model for software development and enhancement. Computer, 21(5):440 454, May 1988. [3] G. Booch, J. Rumbaugh, and I. Jacobson. The Unied Modelling Language User Guide. Object Technology Series. Addison-Wesley, 1999. [4] M. Cotterell and B. Hughes. Software Project Management. International Thomson Press, 1995. [5] Davis, A.M. Software Requirements: Objects, Functions and States. Prentice Hall, 1993. Revised Edition. [6] David Harel. Statecharts: A Visual Formalism for Complex Systems. Science of Computer Programming, 8:231274, 1987. [7] B. Hargrave. When to prototype: Decision variables used in industry. Information and Software Technology, 37(2):113118, 1995. [8] ANSI/IEEE Std 610.12-1990,Glossary of Software Engineering Terminology. In IEEE, editor, IEEE Software Engineering Standards Collection. New York, 1994. [9] E. Kazmierczak, P. Dart, M. Winikoff, and L. Sterling. Verifying requirements through mathematical modeling and animation. Internation Journal of Knowledge Engineering and Software Engineering, 2000. To appear. [10] D. Kulak and E. Guiney. Use Cases: Requirements in Context. ACM Press, 2000. [11] Luqi. Status report: Computer-aided prototyping. IEEE Software, 9(6):7781, November 1992. [12] J. McDermid, T. Kelly, M. Nicholson, and D. Pumfrey. Computer system hazard analysis. Course Notes from the High Integrity Systems Group at York University, 1995. [13] B. Oestereich. Developing Software with UML: Object-Oriented Analysis and Design in Practice. Object Technology. Addison-Wesley, 1999. [14] S.L. Peeger. Software Engineering: Theory and Practice. Prentice-Hall, 1998.
120
[15] R. Pooley and P. Stevens. Using UML: Software Engineering with Objects and Components. Object Technology Series. Addison-Wesley, 1999. [16] R. Pressman. Software Engineering: A Practitioners Approach. McGraw-Hill, fourth edition, 1997. [17] W. Royce. Managing the development of large software systems. In IEEE WESCON, pages 19, August 1970. [18] J. Rumbaugh. Object-Oriented Modeling and Design. Prentice-Hall, 1991. [19] Philip Sallis, Graham Tate, and Stephen McDonell. Software Engineering. Addison Wesley Publishing Co., 1995. [20] Software Engineering Standards Commitee of the IEEE. IEEE Recommended Practice for Software Requirements Specications. IEEE, 1993. [21] I. Sommerville. Software Engineering. Addison-Wesley, fth edition, 1996. [22] A.M. Stareld, K.A. Smith, and A.L. Bleloch. How to Model It: Problem Solving for the Computer Age. McGraw-Hill Publishing Company, 1990.
121