When people discuss the future of computers and software, a common worry is that it will become increasingly difficult to produce correct software due to the ongoing surge in complexity. A common joke is to imagine what cars would be like if they were as buggy as software. I believe these fears are groundless, and that they arise from a misunderstanding of the reason why current software is full of bugs.
Modern software contains bugs because bugs aren’t the problem.
The reason we have bugs in computer software is not because writing bug-free code is impossible. Rather, it is because writing bug-free code is expensive. Eliminating all bugs requires enough extra time and money that it isn’t economically advantageous for the vast majority of applications.
In areas where correctness is more critical, we spend more money and get correctness. Hardware is an excellent example of this: a modern CPU has somewhere around a billion transistors, and is usually bug-free. This is because hardware companies spend vast amounts of money on formal verification methods which rigorously check the correctness of circuit designs. It has to be correct in order to work, so we make it correct. This also applies to software in critical areas: when was the last time you heard about a bug in the software for your car?
For now, most software usually doesn’t need to be correct (witness the explosion of dynamically typed scripting languages). As our dependence on software grows, our demands on its correctness will increase, and software will become correct. To do this, we’ll use a combination of model checking, better languages, formal verification, etc. The ideas required to do this have been around for a long time, are constantly improving, and will improve even faster when we need them more and start devoting real resources to them.
I think this shift will happen soon, but the timing depends primarily on the economics of software, not technical issues. As soon as we’re willing to pay extra to get bug-free software, people will start writing it.