Software Engineering for Students A Programming Approach
Software Engineering for Students A Programming Approach Software Engineering for Students A Programming Approach
4.2 The concept of a requirement 37 Establishing the requirements for a software system is the first step in trying to ensure that a system does what its prospective users want. This endeavor continues throughout the software development and is called validation. The requirements specification has a second vital role. It is the yardstick for assessing whether the software works correctly – that it is free from bugs. The job of striving to ensure that software is free from errors is a time-consuming and difficult process that takes place throughout development. It is called verification. Errors in specification can contribute hugely to testing and maintenance costs. The cost of fixing an error during testing can be 200 times the cost of fixing it during specification. It is estimated that something like 50% of bugs arise from poor specification. The remedy of course is to detect (or prevent) bugs early, that is, during specification. It is easy to write poor requirements specifications for software; it is difficult to write good specifications. In this chapter we will examine guidelines for writing specifications. Remember that specifications are not usually written once and then frozen. More typically, requirements change during the software development as the users’ requirements are clarified and modified. 4.2 ● The concept of a requirement The task of analyzing and defining the requirements for a system is not new or peculiar to software. For generations, engineers have been carrying out these activities. For example, the following is part of the requirements specification for a railway locomotive: On a dry track, the locomotive must be able to start a train of up to 100 tonnes on an incline of up to 30% with an acceleration of at least 30 km/h/h. This statement serves to emphasize that a requirement tells us what the user (in this case the railway company) wants. It says nothing about how the locomotive should be built. Thus, it does not state whether the locomotive is diesel, coal or nuclear powered. It says nothing about the shape or the wheel arrangements. One of the great controversies in computing is whether it is desirable (or even possible) to specify what a system should do without considering how the system will do it. This is the relationship between specification and implementation. We will now look at both sides of this argument. On the one hand, there are several reasons why the requirements specification should avoid implementation issues. The prime reason is that the user cannot reasonably be expected to understand the technical issues of implementation and cannot therefore be expected to agree such elements of the specification. To emphasize the point, how many users of a word processor really understand how software works? A second reason for minimizing implementation considerations is to avoid unduly constraining the implementation. It is best if the developer has a free reign to use whatever tools and techniques he or she chooses – so long as the requirements are met.
38 Chapter 4 ■ Requirements engineering On the other hand, some people argue that it is impossible to divorce specification and implementation. Indeed, in several major approaches to specification they are intermixed. In such a method, the first task is to understand and to document the workings of an existing system. (This might be a manual or a computer-based system, or some combination.) This investigation serves as the prelude to the development of a new computer system. Thus the implementation of one system (the old) acts as a major ingredient in the specification for the new system. For example, suppose we wished to develop a computer system for a library that currently does not use computers. One approach would be to investigate and document all the current manual procedures for buying books, cataloging, shelving, loaning, etc. Having accomplished this task, the next step is to decide which areas of activity are to be computerized (for example, the loans system). Finally, the specification of the new system is derived from the design (implementation) of the old system. This approach to development seems very appealing and logical. However, it does mean that implementation and specification are intertwined. There are several, additional and powerful reasons why the analyst must think about implementation during specification. First, they must check that a requirement is technically possible. For example, is it possible to achieve a response time of 0.1 second? Second, it is vital to consider implementation in order to estimate the cost and delivery date of the software. In order to estimate figures for performance and cost it will almost certainly be necessary to carry out some outline development at least as far as architectural design. So, an ideal specification stipulates what, not how. But this is not always practical. 4.3 ● The qualities of a specification We have seen that, ideally, a specification should confine itself to what is needed. We now present a list of desirable qualities for a specification. A good specification should exhibit the following characteristics: ■ implementation free – what is needed, not how this is achieved ■ complete – there is nothing missing ■ consistent – no individual requirement contradicts any other ■ unambiguous – each requirement has a single interpretation ■ concise – each requirement is stated once only, without duplication ■ minimal – there are no unnecessary ingredients ■ understandable – by both the clients and the developers ■ achievable – the requirement is technically feasible ■ testable – it can be demonstrated that the requirements have been met. This list of desirable features can be used as a checklist when a specification is drawn up. Additionally it can be used as a checklist to examine and improve an existing specification.
- Page 9 and 10: viii Detailed contents 3 The feasib
- Page 11 and 12: x Detailed contents 9 Data flow des
- Page 13 and 14: xii Detailed contents 14.7 Repetiti
- Page 15 and 16: xiv Detailed contents 19.7 Unit tes
- Page 17 and 18: xvi Detailed contents 26 Agile meth
- Page 19 and 20: xviii Detailed contents 32.4 Softwa
- Page 21 and 22: xx Preface Software Engineering and
- Page 23 and 24: xxii Preface are engaged on a proje
- Page 26 and 27: CHAPTER 1 This chapter: ■ reviews
- Page 28 and 29: 1.3 The cost of software production
- Page 30 and 31: 100% 10% 1970 SELF-TEST QUESTION Ha
- Page 32 and 33: Analysis and design 1 /3 Coding 1 /
- Page 34 and 35: SELF-TEST QUESTION 1.7 Maintenance
- Page 36 and 37: 1.8 Reliability 13 in the first pla
- Page 38 and 39: 1.8 Reliability 15 contain a comma
- Page 40 and 41: Ease of maintenance Reliability Con
- Page 42 and 43: Exercises 19 • Exercises These ex
- Page 44 and 45: Further reading 21 Analyses of the
- Page 46 and 47: ■ documentation ■ maintenance
- Page 48 and 49: 2.2 The tasks 25 An important examp
- Page 50 and 51: 2.4 Methodology 27 reality. Like an
- Page 52 and 53: ■ error free ■ fault ■ tested
- Page 54 and 55: 3.2 ● Technical feasibility 3.3 C
- Page 56 and 57: 3.5 Case study 33 The hardware cost
- Page 58 and 59: Answers to self-test questions 3.1
- Page 62 and 63: 4.3 The qualities of a specificatio
- Page 64 and 65: 4.5 The requirements specification
- Page 66 and 67: 4.6 The structure of a specificatio
- Page 68 and 69: 4.7 ● Use cases 4.7 Use cases 45
- Page 70 and 71: Summary The ideal characteristics o
- Page 72: Further reading 49 Further reading
- Page 76 and 77: CHAPTER 5 This chapter explains: 5.
- Page 78 and 79: 5.3 Styles of human-computer interf
- Page 80 and 81: 5.5 Design principles and guideline
- Page 82 and 83: 5.5 Design principles and guideline
- Page 84 and 85: SELF-TEST QUESTION 5.2 What problem
- Page 86 and 87: 5.8 Help systems 63 Our plan is to
- Page 88 and 89: Further reading 65 5.5 Design a use
- Page 90 and 91: CHAPTER 6 Modularity This chapter e
- Page 92 and 93: 6.2 Why modularity? 69 observed fau
- Page 94 and 95: Figure 6.1 Two alternative software
- Page 96 and 97: ■ a simple program is more likely
- Page 98 and 99: 6.6 Information hiding 75 The class
- Page 100 and 101: 6.8 ● Coupling 6.8 Coupling 77 We
- Page 102 and 103: 6. Method calls with parameters tha
- Page 104 and 105: 3. Temporal cohesion 6.9 Cohesion 8
- Page 106 and 107: > } public void setY(int newY) { y
- Page 108 and 109: • Exercises 6.1 What is modularit
4.2 The concept of a requirement 37<br />
Establishing the requirements <strong>for</strong> a software system is the first step in trying to<br />
ensure that a system does what its prospective users want. This endeavor continues<br />
throughout the software development and is called validation.<br />
The requirements specification has a second vital role. It is the yardstick <strong>for</strong> assessing<br />
whether the software works correctly – that it is free from bugs. The job of striving<br />
to ensure that software is free from errors is a time-consuming and difficult process that<br />
takes place throughout development. It is called verification.<br />
Errors in specification can contribute hugely to testing and maintenance costs.<br />
The cost of fixing an error during testing can be 200 times the cost of fixing it during<br />
specification. It is estimated that something like 50% of bugs arise from poor<br />
specification. The remedy of course is to detect (or prevent) bugs early, that is, during<br />
specification.<br />
It is easy to write poor requirements specifications <strong>for</strong> software; it is difficult to write<br />
good specifications. In this chapter we will examine guidelines <strong>for</strong> writing specifications.<br />
Remember that specifications are not usually written once and then frozen. More<br />
typically, requirements change during the software development as the users’ requirements<br />
are clarified and modified.<br />
4.2 ● The concept of a requirement<br />
The task of analyzing and defining the requirements <strong>for</strong> a system is not new or peculiar to<br />
software. For generations, engineers have been carrying out these activities. For example,<br />
the following is part of the requirements specification <strong>for</strong> a railway locomotive:<br />
On a dry track, the locomotive must be able to start a train of up to 100 tonnes on an<br />
incline of up to 30% with an acceleration of at least 30 km/h/h.<br />
This statement serves to emphasize that a requirement tells us what the user (in this case<br />
the railway company) wants. It says nothing about how the locomotive should be built.<br />
Thus, it does not state whether the locomotive is diesel, coal or nuclear powered. It says<br />
nothing about the shape or the wheel arrangements.<br />
One of the great controversies in computing is whether it is desirable (or even possible)<br />
to specify what a system should do without considering how the system will do it. This is<br />
the relationship between specification and implementation. We will now look at both sides<br />
of this argument.<br />
On the one hand, there are several reasons why the requirements specification<br />
should avoid implementation issues. The prime reason is that the user cannot reasonably<br />
be expected to understand the technical issues of implementation and cannot<br />
there<strong>for</strong>e be expected to agree such elements of the specification. To emphasize the<br />
point, how many users of a word processor really understand how software works? A<br />
second reason <strong>for</strong> minimizing implementation considerations is to avoid unduly constraining<br />
the implementation. It is best if the developer has a free reign to use whatever<br />
tools and techniques he or she chooses – so long as the requirements are met.