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.





Usman Ismail
Invite as author
Possible but cost effective?
As you say, it's a cost-benefit tradeoff. But I suspect the only costs being counted are the immediate ones. There are many longer-term costs which may be discounted because the original developers are not going to be around anymore.
For example, when I started developing software in the 1980s, I made sure that all of it would keep working into the next century. Some of my colleagues didn't bother, remarking (slightly nervously) that they thought they wouldn't still be around by then, or the software wouldn't still be in use. Of course, the millennium did eventually arrive and huge costs were incurred making sure software was updated to handle it correctly.
EditSaveCancelDeleteDeleteBlock this userReport abusive commentHide report window