Summary: Debugging Interlude—Debugging Loops

This lesson is a quick summary of this chapter.

  • Testing a program is related to debugging its logic.
  • To fully test a program, we should try all possible paths through its logic.
  • When a program requires input data, the test should use typical data, extreme but acceptable data, as well as unacceptable or incorrect data.
  • Testing a program with every possible piece of data as input is seldom feasible.
  • When tracing the execution of a loop, we should check the accuracy of key variables before and after the loop, as well as at the beginning and end of the loop’s body.
  • Tracing the execution of a loop can produce numerous lines of output, particularly if erroneous logic fails to terminate the repetition.
  • Typically integrated development environments, or IDEs, provide debugging tools that enable us to set breakpoints and watches. We also can step through, or execute, program statements one at a time, and either step through the inner details of a method or skip to its result.

Get hands-on with 1400+ tech skills courses.