15.07.2013 Views

jgrasp handbook

jgrasp handbook

jgrasp handbook

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6.4 Stepping Through a Program<br />

DRAFT, February 18, 2003, Page 66<br />

After the program stops at the breakpoint, the you can use the icons at the top of the debug pane to<br />

single step, step into a method call, step out of a method, run to the cursor, pause the current thread,<br />

resume, and suspend new thread, while watching the call stack and contents of variables change<br />

dynamically. The integrated debugger is especially useful for watching the creation of objects as the user<br />

steps through various levels of constructors. The jGRASP debugger can be used very effectively to<br />

explain programs, since a major part of understanding a program is keeping track (mentally or otherwise)<br />

of the state of the program as one reads from line to line. .<br />

We will make two passes through the example program as we explain it. During the first pass, we will<br />

“step” through the program without “stepping into” any of the method calls, and we will concentrate on the<br />

Variable section. In Figure 50, Variables/Settings pane indicates no local variables have been declared.<br />

Figure 51 shows the results of “stepping” to the next statement. Notice that under Locals in the<br />

Figure 51. Desktop after hemingway (Book) object is created

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!