8.1 Fault avoidance

Faults in a program are a consequence of programming errors—when programmers make mistakes and introduce incorrect code. If the erroneous code is executed, the program fails in some way. An incorrect output may be produced, the program may not terminate, or the program might crash and not continue execution. For example, a programmer may forget to increment a variable in a loop, with the consequence that the loop never terminates.

Therefore, to improve the reliability of your program, you should program in a way that minimizes the number of faults in the program. You can do this by testing your program to reveal faults and then changing the code to remove these faults. However, if you can, it is better to minimize programming ...

Get Engineering Software Products: An Introduction to Modern Software Engineering now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.