Lecture
Why is it that programs sometimes work incorrectly? It's very simple – they are created and used by people. If a user makes a mistake, this can lead to a problem in the program's operation – it is used incorrectly, which means it may behave differently than expected.
An error (error) is a human action that produces an incorrect result.
However, programs are developed and created by people, who can also make (and do make) mistakes. This means that flaws also exist in the software itself. They are called defects or bugs (both terms are equivalent). It is important to remember here that software is something more than just code.
Defect, Bug (Defect, Bug) – a flaw in a component or system that can cause it to fail to perform a certain function. A defect discovered during program execution can cause the failure of an individual component or of the entire system.
When the program code is executed, defects that were introduced back when it was written can manifest themselves: the program may fail to do what it should, or conversely – do what it should not – a failure occurs.
A failure (failure) is a discrepancy between the actual result (actualresult) of the operation of a component or system and the expected result (expectedresult).
A failure in the program's operation can be an indicator of the presence of a defect in it.
Thus, a bug exists when three conditions are simultaneously met:
It is important to understand that not all bugs cause failures – some of them may never manifest themselves at all and remain unnoticed (or may manifest only under very specific circumstances).
The cause of failures can be not only defects, but also environmental conditions: for example, radiation, electromagnetic fields, or pollution can also affect the operation of both software and hardware.
There are, in total, several sources of defects and, accordingly, failures:
Defects can arise at different levels, and the quality of the system will directly depend on whether and when they are fixed.
Quality (Quality) is the degree to which a set of inherent characteristics meets requirements.
Software Quality (Software Quality) is the set of characteristics of software that reflect its ability to satisfy stated and implied needs.
Requirement – a stated need or expectation. It is generally implied or obligatory.

In the first case, everything was done correctly, and we obtained a product that fully meets the customer's expectations and satisfies the quality criteria.
In the second case, errors were already made during coding, which led to defects appearing in the finished product. But at this level, bugs are fairly easy to detect and fix, since we can see the discrepancy with the requirements.
The third variant is worse – here, errors were made at the system design stage. This can only be noticed by carrying out a thorough check against the specification. Fixing such defects is also not easy – the product's design has to be reworked from scratch.
In the fourth case, defects were introduced back at the stage of forming the requirements; all further development, and even testing, followed an initially incorrect path from the start. During testing we will not find any bugs – the program will pass all the tests, but may be rejected by the customer.
Conditionally, five causes of defects appearing in program code can be identified.
Comments