Please enable JavaScript.
Coggle requires JavaScript to display documents.
Debugging (What causes bugs? (Coding wrong (Not properly understanding…
Debugging
What causes bugs?
Program logic wrong
Coding wrong
Simple mistake
Not properly understanding something
Methods of library classes
Check the documentation
Language features
Bug in underlying language or operating system environment (rare but difficult to overcome)
What do we want to do?
Find the cause of the bug
Know the reasons for common exceptions
NPE
Stack overflow
Track it down
Find where it occurs
Print statements to inspect state of variables at strategic points
Wolf-fencing (also know as binary search or divide and conquer)
If there is a crash look at the stack trace
Only change one thing at a time
Keep a last good version and if a bug appears look for what is different
Debugger may help but has significant learning overhead
Inspect code
Fix the bug
What is a bug?
Running program produces incorrect output or doesn't behave as expected
Program crashes
State of mind
Can we reproduce the bug?
If so we can fix it!
Rubber duck