Why does it happen that programs don’t work properly? It is very simple – they are created and used by humans. If a user makes a mistake, it can cause a problem with the program – it is not used correctly, and so it may not behave as expected.

An error is a human action that produces an incorrect result.

However, programs are designed and created by people who can (and do) make mistakes. This means that there are flaws in the software itself. These are called defects or bugs (both are equivalent). The important thing to remember here is that software is more than just code.

Defect, Bug – A flaw in a component or system that can cause a particular functionality to fail. A defect detected during program execution can cause the failure of a single component or the entire system.

When executing the program code, the defects embedded at the time of its writing may manifest themselves: the program may not do what it should do or, on the contrary, it may do what it should not do – a failure occurs.

Failure is a discrepancy between the actual result (actualresult) of a component or system and the expected result (expectedresult).

A failure in a program may be an indicator of a defect in it.

Thus, a bug exists when three conditions are met simultaneously:

  • the expected result is known;
  • the actual result is known;
  • the actual result differs from the expected result.
  • It is important to realize that not all bugs cause failures – some of them may not manifest themselves in any way and remain undetected (or may manifest themselves only under very specific circumstances).

Failures can be caused not only by defects, but also by environmental conditions: for example, radiation, electromagnetic fields or pollution can also affect the operation of both software and hardware.

In total, there are several sources of defects and thus failures:

  • errors in the specification, design or implementation of the software system;
  • errors in the use of the system;
  • unfavorable environmental conditions;
  • willful infliction of harm;
  • potential consequences of previous errors, conditions, or willful acts.
  • Defects can occur at different levels, and whether and when they are corrected will directly affect the quality of the system.

Conventionally, we can distinguish five causes of defects in program code.

  • Lack or absence of communication within the team. Often, business requirements simply do not reach the development team. The customer has an understanding of what he wants the finished product to look like, but if his idea is not properly explained to developers and testers, the result may not turn out as expected. Requirements should be available and understandable to all participants of the software development process;
  • Software complexity. Modern software consists of many components that are combined into complex software systems. Multi-threaded applications, client-server and distributed architecture, multi-tiered databases – programs are becoming more and more difficult to write and maintain, and the harder the work of programmers becomes. And the harder the job, the more mistakes the person performing it can make;
  • Requirements changes. Even minor changes in requirements at later stages of development require a large amount of work to make changes to the system. The design and architecture of the application changes, which, in turn, requires changes in the source code and principles of interaction of program modules. Such ongoing changes often become a source of hard-to-find defects. Nevertheless, frequently changing requirements in today’s business are the rule rather than the exception, so continuous testing and risk control in such conditions is the direct responsibility of quality assurance specialists;
  • Poorly documented code. Poorly written and poorly documented program code is difficult to maintain and change. Many companies have special rules for programmers to write and document code. Though in practice it often happens that developers have to write programs fast first of all and it affects the quality of the product;
  • Software development tools. Visualization tools, libraries, compilers, script generators and other auxiliary development tools are also often poorly working and poorly documented programs that can become a source of defects in the finished product.