Bug-free Software is Possible

Until the mid 1980s, the prevailing expectation was that computer software would be bug-free.

After the release of Windows 1.0, people started saying that you couldn't expect complex software to be bug-free. That attitude incensed me. Software can be as robust and bug-free as people want it to be.

When the New Zealand Herald started telling people to expect bugs in their software, I wrote this rebuttal which they later published. It's a bit dated (it was written in 1986), and the battle to expect bug-free software has since been lost, but the points remain valid.




The biggest cause of bugs in computer software is the widespread expectation that they are an inevitable component of complex computer systems.

A recent article in the New Zealand Herald, headed Programming a Messy Business, claimed that writing software today is like building a skyscraper without the help of architects and civil engineers.

The article went on to imply that this situation is a natural consequence of the complex logic inherent in computer software, and that it is difficult to use mathematical tools to avoid errors because logic cannot use the continuous mathematics of materials and engineering.


Tools

The greatest advantage of computer logic is that, barring a hardware malfunction, it always works in a totally predictable way. We do not have to deal with the variances and uncertainties of engineering methods and materials.

Our problem is simply one of managing complexity and designing out human error.

The tools for producing error-free systems have been well-developed but little applied. Where they have been applied, the results have been spectacular. In several cases, programming bugs have been reduced to less than one per programmer per year.

So how does one go about producing a bug-free system?

Design First

First, choose an appropriate language. Languages differ in their potential for bugs.

A good fourth generation language takes care of database access, screen handling, security checking, transaction logging and other standard operations. This removes the potential for whole classes of bugs, since programs need not be written to perform those functions.

Second, design first, just like an engineer does. Make sure you have a sound, workable design before you start coding.

If you discover halfway through a project that your design is not sound, don't patch it. Throw it away and start again. No matter how much this costs, in the long run the patch will cost more.

Tedious

Design controlled redundancy into your programs. If you have to perform a precise, intricate calculation also perform a simple, approximate calculation to check the result for reasonableness.

Third, make selective use of program proofs. These mathematical techniques are unmanageably tedious for use on complete systems, but they are highly useful for small, difficult pieces of code.

It is a great feeling to prove a critical piece of code correct, rather than to feel that the code tests all right but may show some defect under extreme conditions.

Fourth, test your program effectively. Techniques for assembling effective test data are widely described in computer literature.

How Far

Fifth, control and manage change. Ensure that changes are designed in and not patched on.

With these techniques you can make your software as bug-free as you like?

How far should you go? In practice, it is difficult to make your software more bug-free than the underlying operating system and programming language. After that, it becomes more and more difficult to effectively test your work.

So let us cast aside this expectation that bugs are an unavoidable side-effect of software, and work towards a world where programs that fail are as rare as skyscrapers that collapse.

Comments

Possible but cost effective?

I am guessing they make fairly bug free software for real time applications such as aircraft control etc but there is a cost benefit trade off when writing bug free software for general applications. Still interesting points in your article.

Last edited Jan 29, 2009 2:02 AM
Report abusive comment
Roger Browne
Roger Browne
Software developer, writer, researcher at Uclue
England
Article rating:
Your rating:

Activity for this knol

This week:

19pageviews

Totals:

371pageviews
2comments