- Shopping Bag ( 0 items )
Ships from: MAYFIELD HEIGHTS, OH
Usually ships in 1-2 business days
Ships from: Albuquerque, NM
Usually ships in 1-2 business days
|Ch. 2||Common Syntax and Semantic Errors||5|
|Ch. 3||Tracing Techniques for Debugging||21|
|3.3||Common Errors Detectable with Basic Tracing||28|
|3.4||Trace On and Off Flag||35|
|3.5||Tracing Using Function Calls||39|
|3.6||Tracing for Data in Arrays||40|
|3.7||Where to Insert the Traces and What Variables To Display||47|
|3.8||Using the Assert Macro||48|
|Ch. 4||Trace Debugging for More Advanced C++ Constructs||51|
|Ch. 5||Using an Interactive Debugger||69|
|5.3||Debugging with Metrowerks CodeWarrior||71|
|5.4||Example: Debugging a Sample C++ Program Using Metrowerks CodeWarrior||76|
|5.5||Debugging with Microsoft Visual C++||84|
|5.6||Example: Debugging a Sample C++ Program Using Microsoft Visual C++||89|
|App. A||The 32 Most Common Bugs in First Programs||97|
|App. B||Checklist for Error Detection and Prevention||99|
The motivation for this book came as a result of innumerable sessions in the computer lab with introductory programming classes at the University of Michigan. Unfortunately, many beginning programmers subscribe to the "programming by blind faith" method, writing the complete program, then hoping it will run correctly the first time without doing any intermediate testing, and then panicking when it crashes or generates bad data that cannot be explained. Each time they come to us with "What do I do now?" we go back to the program together to look over the basic logic, and then start inserting traces to check the intermediate results and localize the sources of error. We have come to the conclusion that students need a short, clear debugging guide as a valuable addition to their other programming tools, something they can easily carry with them and with which they can supplement their introductory programming textbooks.
Chapter 1 is a short motivational chapter that summarizes the common sources of errors in computer programs.
Chapter 2 describes the most commonsyntactic and semantic programming errors (with illustrative examples) and explains how to correct them.
Chapter 3 shows the student how to use output statements (cout) to trace variables in C++ programs, and how tracing can be easily inserted into his or her own programs. Several examples are given to illustrate how tracing can help find bugs—especially when a program runs without any runtime errors, but the results are incorrect. It also is useful to find errors quickly when the program crashes with an error message or just hangs up, leaving the programmer with no option but to kill the program and reboot the computer, over and over, until the bug is found.
Chapter 4 applies the basic principles of tracing to more advanced C++ constructs, such as strings, pointers, structs, and classes.
Chapter 5 illustrates how to use a debugger effectively as follow-on to the tracing method discussed in Chapters 3 and 4. Most compilers come with debuggers now, and students need to be able to use them at some point during their first course in programming. We strongly recommend learning to use both tracing and the debugger as alternative approaches.
The appendices give a summary of the most common bugs found in first C++ programs and a checklist of techniques for error detection and prevention. The examples in this book conform to the 1998 ISO/ANSI C++ standard.
Beginning programmers should benefit from this book because it is a quick read with many simple examples, both numeric and non-numeric. It should save them many frustrating hours of debugging time when they apply the tracing and system debugger techniques illustrated in Chapters 3 to 5. Furthermore, anyone using this book can easily read any chapter independently of the others. This should also appeal to the more experienced programmers who want to review their knowledge of debugging without wading through all the fundamentals. Instructors in introductory programming classes may want to recommend this book to their students, because it will make them much more self sufficient, and it will greatly reduce the time they need for individual counseling for their programs.
Beginning programmers should read Chapters 1 and 2 to get a quick overview of the basic types of errors programmers tend to make. Chapters 3 and 4 are self-contained discussions of how to use tracing in your programs with a minimum of effort. Chapter 5 is more advanced and may be used later, when you feel the need for more debugging options, especially for larger programs.