< previous page page_x next page >

Page x
chapters focus only on the int, float, and char types and the basic arithmetic operators. Details of the other data types and the more elaborate C++ operators are postponed until Chapter 10.
The top-down and object-oriented design methodologies are a major focus of Chapter 4, and the discussion is written with a healthy degree of formalism. This early in the book, the treatment of object-oriented design is necessarily more superficial than that of top-down design. However, students gain the perspective that there are twonot onedesign methodologies in widespread use and that each serves a specific purpose. Chapter 4 also covers input and file I/O. The early introduction of files permits the assignment of programming problems that require the use of sample data files.
Students learn to recognize functions in Chapters 1 and 2, and they learn to use standard library functions in Chapter 3. Chapter 4 reinforces the basic concepts of function calls, parameter passing, and function libraries. Chapter 4 also relates functions to the implementation of modular designs and begins the discussion of interface design that is essential to writing proper functions.
Chapter 5 begins with Boolean data, but its main purpose is to introduce the concept of flow of control. Selection, using If-Then and If-Then-Else structures, is used to demonstrate the distinction between physical ordering of statements and logical ordering. We also develop the concept of nested control structures. Chapter 5 concludes with a lengthy Testing and Debugging section that expands on the modular design discussion by introducing preconditions and postconditions. The algorithm walk-through and code walk-through are introduced as means of preventing errors, and the execution trace is used to find errors that made it into the code. We also cover data validation and testing strategies extensively in this section.
Chapter 6 is devoted to looping structures. We introduce all of the structures using the syntax of the While statement. Rather than confuse students with multiple syntactical structures, our approach is to teach the concepts of looping using only the While statement. However, because many instructors have told us that they prefer to show students the syntax for all of C++'s loops at once, the discussion of For and Do-While statements in Chapter 9 can be covered optionally after Chapter 6.
We first introduce students to the basic loop control strategies and common looping operations. We then describe how to design loops using a checklist of seven questions. The checklist leads naturally to a discussion of the loop invariant as a means of validating a loop design. Because of the introduction of preconditions and postconditions in Chapter 5, we can now cover the loop invariant at a higher level. Chapter 6 also introduces the topics of Big-O notation and finite state machines.
By Chapter 7, the students are already comfortable with breaking problems into modules and using library functions, and they are ready to master the complexity of writing their own functions. Chapter 7 focuses on parameter passage by value and covers flow of control in function calls, formal and actual parameters, local variables, and interface design. The last topic in-

 
< previous page page_x next page >