4-20100920-1 - Introduction to OO Program Design Software...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to OO Program Design Software College of SCU Instructor: Shu Li Email: shuli@scu.edu.cn
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Unit 1.1 Java Applications 1.1.8 Debugging 1.1.9 Debugging with Eclipse
Background image of page 2
3 Types of Errors There are three general types of errors: Syntax (or “compile time”) errors Syntax errors are “grammatical” errors and are detected when you compile the program Syntax errors prevent your program from executing Runtime errors Runtime errors occur when you tell the computer to do something illegal Runtime errors may halt execution of your program Logic errors Logic errors are not detected by the computer Logic errors cause your results to be wrong
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 What to Do about Errors? Error messages are your friends read them and try to understand them With practice, you can fix most syntax errors almost immediately Runtime and logic errors may take considerably longer to track down and fix Here’s what’s important to remember: Everyone makes lots of stupid errors (and almost all errors are stupid ones--mine included); it’s nothing to be ashamed of However, it is not OK to let those errors survive Approximately 90% of your time will be spent debugging
Background image of page 4
5 About The “Bug”
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 What is Debugging? You tell me! Everybody writes codes with bugs. Things to think about: What caused the bug? How did you end up finding it? How could you have avoided the bug in the first-place?
Background image of page 6
7 Debugging Philosophy Think about why you believe the program should produce the output you expected. Make assertions until you understand how your view differs from the computer.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Strategies to Live By. .. Debugging is part art, part science. You’ll improve with experience.
Background image of page 8
9 Strategy #1:Debug with Purpose Don' t just change code and hope you' ll fix the problem! Instead, make the bug reproducible, then use methodical hypothesis testing? While(bug) { Ask, what is the simplest input that produces the bug? Identify assumptions that you made about program operation that could be false. Ask yourself how does the outcome of this test/change guide me toward finding the problem?
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 45

4-20100920-1 - Introduction to OO Program Design Software...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online