The Goddess Chalchihuitlicue, found in the Valley of Mexico, 1300-1500 AD (stone), Aztec / Muse de l'Homme, Paris, France / Bridgeman Art Library
This part introduces the use of exception handling and assertions to make your programs robust and correct, the use of input and output to manage and process a large quantity of binary data, and the use of recursion to write methods for solving inherently recursive problems.
[Page 576] Prerequisites for Part 4
All the chapters after Chapter 17 are designed to minimize dependencies so that they can be reordered flexibly.
Chapter 17, "Exceptions and Assertions," can be covered after Chapter 9, "Inheritance and Polymorphism." Chapter 18, "Binary I/O," is usually covered after Chapter 17.
The concept of recursion and how to write simple recursive programs in 19.119.3 can be covered after Chapter 6, "Arrays."
|
|
|
Objectives |
|
Three categories of errors (syntax errors, runtime errors, and logic errors) were introduced in 2.15, "Programming Errors." Syntax errors arise because the rules of the language have not been followed. They are detected by the compiler. Runtime errors occur while the program is running if the environment detects an operation that is impossible to carry out. Logic errors occur when a program doesn't perform the way it was intended to. In general, syntax errors are easy to find and easy to correct because the compiler indicates where they came from and why they occurred. You can use the debugging techniques introduced in 2.16, "Debugging," to find logic errors. This chapter introduces using exception handling to deal with runtime errors and using assertions to help ensure program correctness.