This is impossible to make bug free product. Even people who used to say themselves expert in certain technology, They also make blunders and make errors in code. These errors come due to some reason like
1- Time pressure of completing module on time
2- Physically tiered due to long run of writing 1000 lines of code in a single sitting
3- Cut and paste also intends many errors and it also digress developer from real workflow
But I think we should go through real one that cause major bugs in product
1- Mis-communication while writing requirement initially : Most of the time bugs appears because people don’t go through requirement and In this functionality are given.These bugs appears due to oversights or mutual misunderstandings made by a software team during specification, design, coding, data entry and documentation. complex bugs can arise from unintended interactions between different parts of a computer program. This frequently occurs because computer programs can be complex — millions of lines long in some cases — often having been programmed by many people over a great length of time, so that programmers are unable to mentally track every possible way in which parts can interact. In era of Internet more and more complex products are being developed and so some time poor design lowers the quality of product.
2- Errors in Code : human errors made while writing code and in these normally syntax error, wrong positioning of loop and conditions comes that introduce limitation to access certain thing.
Some bugs appear if logic design is not proper
3- When requirement changes with each day :Small changes in requirement each day make it difficult to understand the real work environment and real workflow. This not only affect the code but also have impact on the interfacing while integration of module and it also increase the risk of failure of product. Change in requirement also change the need of hardware and software environment.
Some time developer go through redoing all the stuff once again and this not only make developer tiered, Once minds are tiered then chance for error and defects increases.
4- Time pressure to complete module:
Friends as we know that a running man/women can keep his eyes on each detail of his/her way.So chances of mistakes increase because developer don’t care about requirement and some time they lose some important workflow during development
5- Some mistakes happens due to the lack of experience in certain domain.
These are few things that introduce bugs in product and this also increase the risk associated with product.
So to keep bugs away everyone who are involved in development of product should keep eye on Requirement document and should feel to discuss if he/she is not understanding the requirement. But to keep these bugs away we should choose some better programming style, techniques and code analysis and developer or people involved in development should believe more on Debugging tools.
Courtesy : Softwaretestinghelp.com and Software testing Guide and http://en.wikipedia.org/wiki/Software_bug