Testing the App with the Debugger
It is difficult to describe the process of using the debugger because, most of the time, you need to use the debugger when something untoward has happened. The app is in an unknown and possibly unstable condition, so you need to try to analyze and recover from the problem.
In this chapter, you’ll see how to deliberately introduce errors into your code so that you can “find” them with the debugger. Of course, there’s not too much difficulty in finding errors that you have introduced yourself. If you are working in a class or with a group of people, you can pair off to find errors that others have introduced.
Create a new project from the Master-Detail Application template. You’ve used it as the basis of the Party Planner app, so you know a bit about its structure. By starting from an untouched version, you can run it with the debugger to get a sense for how the debugger works. Furthermore, if you want to create code that will generate an error, you can do so without worrying about damaging your own app.
Using Informal Debugging Techniques
A debugger or a colleague can sometimes pinpoint a problem—perhaps a missing comma—and you’ll be able to be on your way again. All too often, the most vexing problems aren’t that simple. Here are some of the techniques that I’ve used. Some are tips from other developers or teachers, and others are strategies that I’ve discovered work for me.
• Take a break—Have a cup of coffee, walk the dog, go ...