Chapter 11

Debugging and Testing

IN THIS CHAPTER

Bullet Identifying common types of programming errors

Bullet Using comments and print statements to debug

Bullet Working with breakpoints and watch variables

Bullet Running tests

Writing a program isn’t easy. Not only do you have to write a program that solves a big problem, but you must also solve a bunch of little problems along the way. Some of those problems might be mini-steps on the way to solving the big problem (such as how to predict whether a given sports team will win this week) while other problems may simply involve working with the hardware such as correctly printing data.

Writing a program takes time. However, a program is never done until it has been tested. Testing helps ensure the program works correctly and reliably. When testing reveals problems, the programmers must fix them, whether they’re minor (such as displaying the wrong icon on the screen) or major (the program crashes). That’s why testing is a crucial part of any software project.

Common Types of Programming Errors

Ultimately, there are a nearly infinite number of ways a program ...

Get Beginning Programming All-in-One For Dummies, 2nd Edition 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.