Presentation is loading. Please wait.

Presentation is loading. Please wait.

Debugging and Troubleshooting

Similar presentations


Presentation on theme: "Debugging and Troubleshooting"— Presentation transcript:

1 Debugging and Troubleshooting
INFO/CSE 100, Spring 2006 Fluency in Information Technology 4/10/2019 fit debug

2 Readings and References
Fluency with Information Technology Chapter 7, To Err is Human “To err is human, but it takes a computer to really foul things up” References World Wide Web Consortium Jedit (java-based editor) 4/10/2019 fit debug

3 Advanced HTML <hr /> a horizontal rule
______________________________ <p>This paragraph has space around it.</p> This is a line<br /> break carried onto the next line P tag has to have an open and a closing tag. The horizontal rule and line break open and close at the same time. 4/10/2019 fit debug

4 HTML Tables <table border="1"> <tr>
<th>Animal</th> <th>Fav food</th> </tr> <td>monkeys</td> <td>bananas</td> <tr><td colspan="2"><hr /></td></tr> </table> Animal Fav food monkeys bananas ___________________ Tables are a really useful way to align items on a page. See CNN website for example. The FIT100 website repositions the items on the screen as the window resizes. 4/10/2019 fit debug

5 List Items List item 1 Another list 1. first item 2. second item
<ul> <li>List item 1</li> <li> <ol> <li>Another list</li> <li>first item</li> <li>second item</li> </ol><li> </ul> List item 1 Another list 1. first item 2. second item List items can be nested. Each web browser will handle errors differently. 4/10/2019 fit debug

6 Character Entities Some characters are special in HTML
<, >, &, ", ' They are interpreted by the web browser To get them to display properly we have to encode them specially < = < > = > & = & " = " &apos; = ' (note: Not in IE)   = non-breaking space Show the example from Lab 3 4/10/2019 fit debug

7 HTML Comments <p>If you want to leave yourself some comments that won't appear in the web browswer window use an HTML comment.</p> <!-- Any text that is between the opening and closing tag will be ignored by the HTML interpreter --> <!-- COMMENT OPEN --> COMMENT CLOSE 4/10/2019 fit debug

8 Using Computers... In IT, stuff goes wrong … debugging is the process of finding the error Term coined by Grace Murray Hopper Best solution … make no mistakes! Be accurate … get it right the 1st time Follow a process that makes it easier to get it right Computers can’t make "common sense" decisions about what we really meant. They do what we say, not what we mean. 1945, GMH found a moth inside of Mark II Relay Harvard, she reported that they had "debugged" the computer. Use a colored editor! Indent your text. Use an HTML validator. Don't forget that path names need to be CASE SENSITIVE Comment, comment, comment! 4/10/2019 fit debug

9 Cost of Debugging Debugging may consume 60-70% of your development time 80% of overruns may be due to debugging Keep this in mind when you are budgeting time for your projects! 4/10/2019 fit debug

10 Common Bug Types Compilation/Syntax errors Logic errors
Program doesn’t won’t run due to problems with what you typed in HTML tags must be entered precisely Required attributes must be present Logic errors Program runs, but output/behavior is wrong 4/10/2019 fit debug

11 When You Debug... There are guidelines for debugging…
Debugging is not algorithmic: no guaranteed process There are guidelines for debugging… Rather than trying things aimlessly and becoming frustrated, think of yourself as solving a mystery Be objective: What are my clues? What is my hypothesis? Do I need more data? Consciously ‘watch’ yourself debug -- its an out-of-body experience When stumped, don’t become frustrated, but ask, “What am I misunderstanding?” Become Sherlock Holmes 4/10/2019 fit debug

12 Debugging Guidelines Verify that the error is reproducible
Determine exactly what the actual failure is Eliminate the “obvious” causes by checking Divide process into working/faulty parts On reaching a dead end, reassess the information you have, trying to identify the mistake you are making Work through process making predictions and checking they’re fulfilled 4/10/2019 fit debug

13 Getting Out and Getting Back In
Reproducibility First step: verify the error is reproducible You can't find something that you can't reproduce Get out and get back in. Does it still happen? Restart the application. Try a different application Reboot the operating system. Sometimes this is appropriate, especially for errors involving peripheral devices (printers, modems) Open page in both IE and Mozilla! Getting Out and Getting Back In 4/10/2019 fit debug

14 This is not a printer problem!
Determine the Problem Second step: figure out what’s wrong Often there is a sequence of steps following an error and propagating it … work backwards looking to see where the error first occurred Empty Database Mailing Label Pgm Mailing Label File No Labels Printing This is not a printer problem! 4/10/2019 fit debug

15 My fan is broken, it won't turn on!
Eliminate the Obvious Third step: eliminate obvious causes “If the cause were obvious, the problem would have been fixed!” - Yeah, right. There are standard things to check: Inputs Connections “Permissions” Physical connectivity Requirements My fan is broken, it won't turn on! 4/10/2019 fit debug

16 Isolate the Problem Try to “partition” the situation into working and non-working parts Form a hypothesis of what’s wrong Make as few assumptions as possible Take nothing for granted The goal is to eliminate as many things from consideration as possible In the case of HTML, is the problem in the head or the body? 4/10/2019 fit debug

17 At a Dead End, Reassess When everything seems to check out, don’t get frustrated Instead, ask yourself “What am I overlooking or misunderstanding?” Your goal is to see the situation as it is, not as you think it should be Am I assuming too much? Am I misreading the clues? What can I eliminate or simplify? Explain the situation to a friend Our brains do a good job of filtering out the small errors. After staring at the same piece of code for a week, its practically impossible to spot small errors! 4/10/2019 fit debug

18 Make Predication/Check
Beginning with the isolated part, step through the process, predicting the outcome and verifying it A prediction that is not fulfilled shows… A possible bug A possible misunderstanding A chance to narrow the search ‘Sleeping on it’ often helps! 4/10/2019 fit debug

19 Summary Debugging is not algorithmic, but there are guidelines to follow Stay calm - high blood pressure clouds your brain Be organized as you investigate and fix things Recognize that you may feel a little embarrassed when you finally figure out the problem. If we were perfect, we would never make mistakes ... A little humility is a good thing for all of us Watch yourself debug -- assess how you are doing, what you need to know Only try to fix one bug at a time! 4/10/2019 fit debug


Download ppt "Debugging and Troubleshooting"

Similar presentations


Ads by Google