CS 162 Lecture-Module #07:
Debugging


while this lecture-material uses an old IDE called NetBeans, debugging is similar in other integrated development~environments such as BlueJ



"debugging" means correcting your program
considering error-messages or other behavior you observe
when you repeatedly try to compile, execute it

this term arose when some computers not electronic (transistor) wiring
but electromechanical
and the programmer/operator Grace Murray Hopper found a moth jamming one relay:
original bug:




address the first error-message when compiling



to start debugging, set a breakpoint (see below) and then start execution as usual
(if program already in the middle of being executed, first conclude that)

depiction of debugging:


: line of operational code at the beginning of which you want execution to pause

non-operational code: comment, declaration, solitary brace, ...
operational code is code that actually does something

multiple ways to  breakpoint:
- click in the thin column at left of target line of code
- when cursor is on line:
    - menu: Debug: New BreakPoint...
may need to successfully compile changed class before setting breakpoints

panel is supposed to show values of variables

means: execute 1 statement and then pause execution
icon:
shortcut: key 
further variations presented subsequently



primitive debugging:   
    really can be useful sometimes




summary of this lecture-module

basics of debugging:


(Copyright © 2009 by Hugh McGuire   — for thoughts about this, see   http://www.cis.gvsu.edu/~mcguire/teaching/copyright_thoughts.html .)