Can we trust the code that increasingly runs our lives?

Nasa administrator Charles Bolden
Image caption Nasa engineers weren't the only ones praying for a smooth landing when Curiosity landed on Mars

Imagine how different the first pictures sent from the Mars Rover would have been if there had been a software failure.

Not to mention pretty hard to get someone along from the IT department to fix it.

One person breathing a sigh of relief when everything worked was Andy Chou, founder of software testing firm Coverity.

Software designed by his firm worked its way through two million lines of Mars Rover code, debugging and fixing problems as the software was being created.

"We were ecstatic that everything worked well," he told the BBC.

"One of the team did say that it found critical defects that could have caused problems if they hadn't been found," he said.

It seems pretty obvious that complex spacecraft would be hugely reliant on software but these days so are many of the more mundane things that we take for granted - from our mobile phones to the cars we drive, from the sites we shop and bank with, to medical devices that keep us healthy.

And just as software designed for space obviously needs to be bug free so too does code that binds us ever more closely to the connected world.

But, with an estimated 50-70% of software projects ending in failure, how can we put our trust in code?

Making mistakes

Improving software's somewhat tarnished reputation was one of the driving forces behind setting up Coverity in 2003, Mr Chou admits.

"To me as a young computer science graduate I felt it was a shame software was seen as unreliable," he said.

Image caption One defect per 1,000 lines of code isn't a bad mistake rate, says Andy Chou

Along with three other PhD students and a professor at Stanford University, Mr Chou set out to create something different - software that could look for bugs as code was being written rather than wait until after the project was completed.

"Software ticks over a lot of different things. It is becoming autonomous and is controlling aspects of daily life that only a few years ago we couldn't imagine," he said.

On average the systems developed by Coverity detects one defect per 1,000 lines of code.

"If you think about 1,000 lines of code that is equivalent to 15 printed pages and if in an essay of that length you only had one error then that is pretty impressive."

But, he admits, there are always going to be below-average software developers.

"Even great developers make mistakes so the important thing is to make sure we put safety nets below so that the mistakes get caught," he added.

As we become ever more reliant on code, firms such as Coverity will become increasingly important.

Freelance coders

But some believe a more radical overhaul of the way software is designed is also needed.

Topcoder is a growing community of more than 420,000 programmers, all of who compete in coding competitions to design software for both business and educational projects.

"Software projects become complex very quickly and they can go off the rails pretty quickly," said Topcoder founder Jack Hughes.

Image caption Jack Hughes hopes Topcoder can become an industry standard

"The software industry is a new one compared to say manufacturing. When you buy a product you expect it to work but software design just hasn't had that process behind it," he said.

By offering projects up to a community of programmers you get better results, much faster, he added.

"We do think that these models will become predominant in the industry."

With skilled programmers in great demand, tech firms are staring to follow what happens on sites such as Topcoder.

It ranks its programmers based on a range of criteria, gold-dust for potential employers.

"A Topcoder rating becomes an important element to people's CVs. Larger companies check this out," said Mr Hughes.

The community is starting to win some high-level clients, such as Medicare, the US government-run health programme. Topcoder recently won the contract to revamp its systems.

"They felt that they had to do something different and really wanted to try something that was a big departure from the usual way of doing things," said Mr Hughes.

Gone golfing

Programmers also seems to love the Topcoder model, often because they can work when they want, ideal for a group of people not renowned for enjoying the nine to five routine.

"They can also work on multiple projects and spread their skills," said Mr Hughes.

Justin Gaspar runs a Topcoder team and says that it the most efficient place he has ever worked.

"With Topcoder you are basically paid to get something done rather than to sit somewhere for eight hours a day," he said.

It also results in far better code, he thinks.

"There is way more oversight and in terms of reviewing, code is looked at by two or three members. Peer review plays a big part."

Mr Gaspar admits that when he is heads down on a project it can mean a lot of late nights, but, on the flip side, when he isn't coding he has time off to play golf.

As the world becomes more connecting, so will our reliance on coders. It has long been predicted that the geek will inherit the Earth.

Let's just hope that they have got enough sleep.

More on this story

Related Internet links

The BBC is not responsible for the content of external Internet sites