21.08.2013 Views

Software Engineering for Students A Programming Approach

Software Engineering for Students A Programming Approach

Software Engineering for Students A Programming Approach

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

29.4 Faults and reliability – estimating bugs 361<br />

A valid complexity measure can potentially help software developers in the following<br />

ways:<br />

■ in estimating the ef<strong>for</strong>t needed in maintaining a component<br />

■ in selecting the simplest design from amongst several candidates<br />

■ in signaling when a component is too complex and there<strong>for</strong>e is in need of restructuring<br />

or subdivision.<br />

29.4 ● Faults and reliability – estimating bugs<br />

The terminology adopted in this book is that a human error in developing software<br />

causes a fault (a bug) which may then cause a failure of the system (or several different<br />

failures). We have seen in Chapter 19 on testing that every significant piece of software<br />

contains faults. There<strong>for</strong>e if we are buying a piece of software it makes sense to<br />

ask the supplier to tell us how many faults there are. If they respond by saying that<br />

there are none, then they are either lying or incompetent. Similarly if we have developed<br />

a piece of software, it would be professional (if we are honest) to be able to tell<br />

users how many (estimated) faults there are and thus give the users some idea of the<br />

expected reliability.<br />

A commonly used metric <strong>for</strong> faults is fault density, which is the estimated number of<br />

faults per 1,000 lines of code. Faults are detected both during verification and during<br />

normal use after the software is put into productive use. Some faults are, of course, corrected<br />

and there<strong>for</strong>e do not count towards the fault density. We must not <strong>for</strong>get that, in<br />

addition to known faults, there are faults that are present but undetected. In commercially<br />

written software, there is an enormous variation in fault densities – figures observed<br />

are between 2 and 50 faults per KLOC (kilo lines of code). A figure of 2 is rated highly<br />

creditable. The fault density metric is useful in assessing the effectiveness of verification<br />

methods and as a measure of correctness (see below) in quality assurance.<br />

Experimental studies suggest that most faults cause only rare failures, whereas a small<br />

number of faults cause most of the failures. Thus it is more cost-effective to fix the small<br />

number of faults which cause most of the trouble – if they can be found.<br />

It would seem to be impossible to gauge how many faults remain in a thoroughly<br />

tested system. After all if we knew what faults there are, we could correct them. One<br />

technique arises from the earth sciences. How do you find out how many fish there are<br />

in a lake? It would be costly (and kill many fish) to drain the lake. An alternative is to<br />

insert additional, specially marked fish into the lake. These could be fish of a different<br />

breed or slightly radioactive fish. After waiting a sufficient time <strong>for</strong> the fish to mix thoroughly,<br />

we catch a number of fish. We measure the proportion of specially marked fish,<br />

and, knowing the original number of special fish, scale up to find the total number of<br />

fish. We can do the same thing in software by deliberately putting in artificial faults into<br />

the software some time be<strong>for</strong>e testing is complete. By measuring the ratio of artificial<br />

to real faults detected, we can calculate the number of remaining real faults. Clearly<br />

this technique depends on the ability to create faults that are of a similar type to the<br />

actual faults.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!