A software bug arises when the expected result don't match with the actual results. It can also be error, flaw, failure, or fault in a computer program. Most bugs arise from mistakes and errors made by developers, architects.
Following are the methods for preventing programmers from introducing bugs during development:
Programming Techniques adopted
Software Development methodologies
Following are the common types of defects that occur during development: