Created by, Tom Rebold, MPC
FLUENCY WITH INFORMATION TECNOLOGY
Skills, Concepts, and Capabilities
Created by, Tom Rebold, MPC
Algorithms and Digitizing Information
PART 2
Created by, Tom Rebold, MPC
TO ERR IS HUMAN
An Introduction to Debugging
chapter7
Precision and AmbiguityDebugging: Isolating the ProblemHTML DebuggingNo Printer Output: A Classic Scenario
To err is human, to really foul things up takes a computer
Copyright © 2003 Pearson Education, Inc. Slide 1-4
Figure 7.1. The Harvard Mark II logbook noting “First actual case of bug being found,” from the Smithsonian Institution.
5
Precision Problems
• How do you say 555-7601 ?
• Need to use “zero” instead of “oh”– Some computers can catch these errors
• [email protected] or [email protected] ?
Fonts matter:• [email protected] or [email protected] ?
• Why can’t computers flag these errors?
6
Lexical Structures
• When entering boxes on forms (field inputs), each field has rules about what is legal or not (lexical structure)
• What are some rules for – Entering grades?– Phone numbers? – E-mail addresses?
• Since case sometimes matters, when in doubt, be as exact as you possibly can
7
Debugging
• People troubleshoot all the time– Car doesn’t start– VCR doesn’t work – Find and repair a faulty part
• Sometimes there is a logical design error– System was designed incorrectly – You can’t always rely on a computer system
• Sometimes you settle for a work around
8
Debugging Principles
• Make sure you can reproduce the error • Determine exactly what the problem is • Eliminate the obvious causes • Divide the process, separate parts that
work from parts that don’t • When stuck, ask where you may be
making wrong assumptions • Make predictions about what should
happen if you try something
9
HTML Debugging
http://terra.mpc.cc.ca.us/~mpc01a30/temples.htmlhttp://terra.mpc.edu/~mpc01a30/temples.html
10
HTML Source Code (w/bugs)<html><head><title>Japan Page</title></head> <body bgcolor="black"><font color="white"> <table>
<tr> <td> <a href="tokyo.html"> Tokyo</a></td> <td> <a href="kyoto.html"> Kyoto</a></td> <ta> <a href="osaka.html"> Osaka</a></td> <td> <a href="hiro.html"> Hiroshima</a></td> <td> <a href="yoko.html"> Yokohama</a></td> <td> <a href="fukuoka.html">Fukuoka</a></td> <td> <a href="sapp.html"> Sapporo</a></td> <td> <a href="oki.html"> Okinawa</a></td> <td> <a href="oni.html"> Onimichi</a></td> </tr> </ table> <hl>Japan! </hl> <h2><font face="Helvetica"><At Heian Shrine</font></h2> <img align="left" src="tang.jpeg" width="234" height="296"> <p> <b>In Japan people visit the temples and shrines
for the perspective they give. </b></p> </body></html>
11
Debug Post-mortem
• Summarize changes made
• Summarized unnecessary changes
• Number of errors found—sometimes more than originally observed (hidden errors)
• Most errors are tiny (1 letter)– With huge effects
12
No Printer Output
• We can debug systems we don’t understand
• Reproduced error, understand problem, check obvious
• How to isolate the problem
• Finding the print queue