Friday, October 4, 2013

Why Can't We Make Bug-free Software?

Computers have revolutionized our lives. While they bring us huge convenience, to say the least, they also cause problems ranging from being trivial to catastrophic.



- You simply click on a link, and then all of sudden, your computer freezes. The web page hangs there forever and the other applications stop responding, too.




-Your computer is hacked. You did some online banking at night, but forgot to log out. The next morning you found almost all of the money on your account had been transferred to an online thief.



-"In 1980, NORAD reported that the



USwas under missile attack. Later it found that the problem was caused by a faulty circuit, a possibility the reporting software hadn't taken into account. "



All the malfunctions I just mentioned above, in software development industry, are called bugs, a vivid term for their being so annoying and so hard to get rid of.



How are bugs brought into software? Why is it so difficult to produce bug-free software?



As a decade-long software developer, today I like to shed some light on the causes of software bugs. If I can summarize them in two sentences, they are: all good-quality software is managed alike; each piece of poor-quality software brings bugs in its own way. Generally, software development involves a 5-phase cycle: requirements specifications, design, implementation, testing and deployment. Unless every phase is well managed, bugs can be introduced at any stage. Here I'll briefly touch on 4 of the 5 most problematic stages.1. Business requirement specifications: Imagined in a perfect world, a developer comes to work on their project day 1. All business requirements documents are laid on his desk, clear and complete. All he has to do is to translate them into code, from human language to machine language.



I have never seen or heard such a case in real life, if it ever exists.



The reality is: often requirements areincomplete, contradictory, dispersed, and ambiguous. They also have a volatile nature - they change over the whole project time. To make it worse, changesare not always well documented, communicated or updated.



The consequence? It is not hard to imagine:if you start on the wrong road, you can never get to the rightdestination.



2. Design: this is about to design the system at a high level including designing architectural layers, choosing technologies and so on.



Today some software products become more and more sophisticated. They play a superhero's role having many of our dreams realized. However, the magic is achieved at the cost of exponential growth of complexity. The complexity can be presented by millions of lines of code, many people's coordinated work, a lot of different technologies, geographically distributed sub-systems, numerous third-party tools and so on.



You see, in such a complex system, bugs can arise from any part and the interactions among one another. Despite tremendous effort, it is still very hard for development to understand everything, take all matters into their hands, and have every possibility well under control.



3. Implementation: this is when programmers program the code, the meaty part of software, where the bugs reside.



In a simplified theory, all bugs are due to human errors. We are human beings and we make mistakes.



One source of mistakes is so-called "bad programming practices".



For example, some developers write "spaghetti code", which has twisted and tangled control structure. Such code is hard to read and maintain, and certainly invites bugs.



Another common cause of bugs is the lack of extensive testing by developers.



Under time pressure, which is the norm in software development industry, developers have to rush to hand down their work to next stage - testing, hoping that testers will be able to intercept all bugs.



Do you thing testers, or QAs will be able to catch all the bugs?



4. Testing



It is safe to say it is very difficult, if not impossible.



The reality is: testing can only go reasonably sufficient. We an never exhaust all scenarios. Not to mention that some scenarios are beyond our imagination and capabilities.



Sadly, another reality is: Murphy's Law always works. The area you neglect to test will come back to bite you.



In conclusion, bugs in software are inevitable. As a user, what can you do then?

First, when problems occur, don't curse developers or smash your computer.

Second, apply every cautious measure when using computer. Be trustful, yet doubt never hurts.
Full Post

No comments:

Post a Comment