The Information School of the University of Washington Oct 9fit debug1 Debugging and Troubleshooting INFO/CSE 100, Fall 2006 Fluency in Information Technology
The Information School of the University of Washington Oct 9fit debug2 Readings and References Reading »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)
The Information School of the University of Washington Oct 9fit debug3 Anchors The link starts with an a tag… The value of the href attribute is a URL. The link encloses some text, and ends with… CSE home page
The Information School of the University of Washington Oct 9fit debug4 Types of URLS ftp://ftp.site.come/pub/ news:soc.culture.religion file:///hardisk/path/file.html
The Information School of the University of Washington Oct 9fit debug5 HTML Tables Animal Fav food monkeys bananas AnimalFav food monkeysbananas ___________________
The Information School of the University of Washington Oct 9fit debug6 Simple HTML What we’ve seen here is very simple HTML HTML is changing »Each document should start with a “ DOCTYPE ” comment telling which version of HTML it follows We used HTML 4.01 Transitional »There is a validator service that will check your page <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
The Information School of the University of Washington Oct 9fit debug7 Editing by Hand vs. a Tool WYSIWYG type tools (what you see is what you get) »Microsoft FrontPage - $$$ »Macromedia DreamWeaver - $$$ »Amaya - Free »And MANY MANY others! Text Editors »Jedit - Free Pick the right tool for you!
The Information School of the University of Washington Oct 9fit debug8 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 »< = < »> = > »& = & »" = " »' = ' » = non-breaking space
The Information School of the University of Washington Oct 9fit debug9 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 1 st 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.
The Information School of the University of Washington Oct 9fit debug10 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!
The Information School of the University of Washington Oct 9fit debug11 Common Bug Types Compilation/Syntax errors »Program 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
The Information School of the University of Washington Oct 9fit debug12 When You Debug... 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 Debugging is not algorithmic: no guaranteed process
The Information School of the University of Washington Oct 9fit debug13 Debugging Guidelines Overview »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
The Information School of the University of Washington Oct 9fit debug14 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) Getting Out and Getting Back In Reproducibility
The Information School of the University of Washington Oct 9fit debug15 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!
The Information School of the University of Washington Oct 9fit debug16 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!
The Information School of the University of Washington Oct 9fit debug17 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
The Information School of the University of Washington Oct 9fit debug18 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
The Information School of the University of Washington Oct 9fit debug19 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!
The Information School of the University of Washington Oct 9fit debug20 Questions Why learn HTML at all if authoring tools will do the work for you? Give other examples of where you are expected to learn something when there are tools available that will do the work.
The Information School of the University of Washington Oct 9fit debug21 Questions Why do we need to end a tag? Why were the characters chosen to denote tags?
The Information School of the University of Washington Oct 9fit debug22 Questions How does a web browser know where to get an image from to display on a web page?
The Information School of the University of Washington Oct 9fit debug23 Questions You walk into a room and flip the light switch. Nothing happens. Describe the debugging process you use to solve the problem.
The Information School of the University of Washington Oct 9fit debug24 Questions What advantages does an organized debugging approach have over a trial and error approach?
The Information School of the University of Washington Oct 9fit debug25 Project 1 Make a website of “misinformation” »Project 1a Planning, image collection, basic web site creation »Project 1b Website design, image manipulation Project 1a due Friday, October 13, before 10:00 pm. »Use online turn in page to submit your files »We will not accept late projects - turn in what you have even if you are not done (some points are better than no points) ssignments/files/project1.htmlhttp://courses.washington.edu/info100/classwork/a ssignments/files/project1.html
The Information School of the University of Washington Oct 9fit debug26 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!