1 / 40

Introduction to Computers CS1100.01 Dr. Zhizhang Shen

Chapter 7: What Went Wrong, How to fix it?. Introduction to Computers CS1100.01 Dr. Zhizhang Shen. Computers are usually reliable, but…. We use computers to do everything today. They usually work, but exceptions do exist. Anything recently?

machiko-rin
Download Presentation

Introduction to Computers CS1100.01 Dr. Zhizhang Shen

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 7: What Went Wrong, How to fix it? Introduction to ComputersCS1100.01 Dr. Zhizhang Shen

  2. Computers are usually reliable, but… • We use computers to do everything today. • They usually work, but exceptions do exist. • Anything recently? • Why exceptions? We only hear such news of “A person bit a bog.” but not “A dog bit a person.” • It is really not computer’s error, but…

  3. Whose fault is this? • All the computer related stuff, hardware, software, user manual, …, are created by human beings. • It is quite likely that something is wrong. • The question is how to find the errors? and once found, how to fix them?

  4. Precision: The bloodline of IT • We can be imprecise, but a computer can’t • Many people say "oh" rather than zero when giving a phone number. The automatic system may not get it. • The listener makes the mental conversion because he knows phone numbers are numeric • Computer does not know that unless it has been programmed to know it.

  5. How precise is “precise”? • We can program software to automatically convert “oh” to zero because all digits in these cases will always be numbers • In other cases such as e-mail, we have to allow both letters and numbers, so the computer can't be programmed to auto-correct. • Users have to be careful, i.e., they have to provide whatever as required by the machine. This is where the manual kicks in.

  6. What should they look like? • The information entered into boxes/forms on screen is governed by lexical structures (rules about the legal form for input fields) • May limit symbols that can appear in specific positions, length of entry, etc.: at least 6 characters long, and has to be a combination of letters and digits. • This is particularly true for password, since a combination of letters and digits makes it much more difficult to break.

  7. About debugging… • Debugging: Figure out why a process or system doesn't work properly • Usually learned from experience • Debugging in everyday Life: Why the car doesn't start? • Running out of gas, spark plug needs replacement,… • Call “car talk” • Debugging in Information Technology: • A user might enter wrong data or wrong configuration information into a working system, ‘F-’ for a grade; or • There might be a logical design error in a system, a buggy program: you can answer both “yes” and “no” in a survey form. • You learn the basics in a series of programming courses.

  8. Whose fault is it? • When we debug an information system, we might be part of the problem • We give an incorrect command and/or input • Operator or pilot error. Instead of stepping on the brake pedal, you step on the oil pedal. • Another possible cause is a broken system: • The break fluid pipe is leaking, costing $$$. • People don't knowingly make errors, except… • We may think we did everything right, but we actually misunderstand the system: Where is the windshield wipe button in this car?

  9. Using the computer to debug? • A computer can't debug itself, we have to do it: • We can’t pull ourselves out of the pool, a lifeguard has to. • Errors are internal to the computer • To get information about the error, we have to ask the computer what data it stored, what it does to them, what is the value of which data at what point, etc.. • Thus, a “dump” usually helps. The trouble is where to look at.

  10. A Dialog About Debugging • Debugging is solving a mystery • What happened? How could it happen? • A printer is not printing? • Ask purposeful questions like: • Do I need more clues? Is it falling out? • Are my clues reliable? Is it really not printing? • What is a theory to explain the problem? Are you nuts?

  11. A debugging process: • Check that the error is reproducible, rather than random. The printer has not been working for a while, instead of just this page. • Check all the "obvious" sources of error: Is the power off? Is the cable off the hook? Out of paper? • Isolate the problem • Divide operation into those parts that are working and those that are not working: Trying to isolate the problem. I do have power for the machine. • Think objectively—ask yourself if you've made a wrong assumption, etc. Have I put in paper in the paper tray this morning? • Think about the big picture, since….

  12. It is a process… • If no mailing labels come out of printer, problem may be • with the printer itself, or • the program that generates those labels from a file, or • the file containing addresses, or • the cable that sends the stuff to the printer?

  13. Butterflies and bugs: A Case Study • Errors can arise for both software and hardware. • Particular, they come up in programming. • As an example, assume that we've developed a simple HTML page, with the following display in mind.

  14. Our Goal Page:

  15. Huston, we have a problem….

  16. Butterflies and bugs (cont'd) • Displaying the page in Safari and Mozilla also produces errors • To reproduce the problem, test it in multiple browsers! If it doesn’t work in all of them, it is very likely related to the code. • We now have to study the HTML code very closely and find out the bug • Where is the “hay”?

  17. Where is the beef? • Look at the displayed page and determine where the errors occur • What are the issues: missing links, no pictures, and the wrong color of blue. • What to do? • We always try to fix the very first error, which can mess up with everything afterwards. • Once the first one is fixed, the others might be fixed, as well. • This is particularly true in programming.

  18. What is the very first error? • The blue caption seems to be the first. • What happens? • The word Blues appears in red on the page, instead of blue. as intended. • Where is the blue specified? • Right ahead of the table. • <caption><b><font color=blue">Blues</font> • What is wrong here? • Missing opening quotation mark around the attribute value “blue” • How to fix it? Add that missing half back.

  19. The HTML for Our Page

  20. Another common error… In HTML, a quite common error is forgetting to close a tag • For example: <b> with no closing </b> tag • Thus, we have to make sure that all quotes match (open and close). • The best way to do it is to come up with a pair first, then fill in the content.

  21. Why is the More here link stil missing? • The next issue is that the link “More here” is not there. • Where is this link specified? Right above the table: • <ahref=“ “> More here. <a> • What went wrong? There should be a space between “a” and “href”. • It now looks better.

  22. Why is the first row blue? An important thing is always cut a complicated task into a bunch of smaller and simpler ones: • Where? First row of the table • What do we want? Silver. • Where is it specified? In the background color. • What went wrong? A fancy quote around “silver” that the browser cannot interpret

  23. Why no pictures? • The pictures are not displaying. • The image tags are well structured and the browser is interpreting them correctly • To check that the images are ok, display in another document, or use paint to verify that they are really images. • To check that the JPEG specification is ok, put another image file in the document • Check the exact file name, and path, for the image, including capitalization • What went wrong? The filename extension is .jpeg, not .jpg as we have been using. • Make sure that both parts of the names do match.

  24. Have we done too much? • During the debugging process, we often make some unnecessary changes due to wrong conjectures about the error. Who knows what’s wrong. • Sometimes we even make the situation worse by introducing new errors. Unnecessarily change parts • Remember what you did and change back later using comments. <!-- 

  25. Got more than what we bargging for • Hiding other errors: • At first we thought we had three errors—bad caption, missing link, busted table • Because there were two things wrong with the table (messed up heading line and wrong file names specified) there were actually four errors • Because it is common for one error to hide another, always suspect there are more than one errors.

  26. Debugging tools are useful • Viewing the source: • Most effective technique in our debugging was the View Source feature. You can compare what you want it to show and what it actually shows, i.e., the intended output and the actual one. • In general, one of the most powerful debugging techniques is to find ways for the computer to tell us the meaning of the information it stores or the commands it executes. Not what we think it should do, but what it does. • Little errors, big problems: • The errors in the HTML code were tiny, but they had serious effects. Also true in general programming • We must be extremely precise and careful.

  27. Where is the print out? • The software is very complicated. How do we troubleshoot a system we don't understand? • Generally, software has been extensively tested before we come in contact with it (QC team) • Standard operations are likely to be bug-free • To illustrate debugging a system without understanding it, consider a common problem: • You try to print a document and nothing comes out of the printer

  28. Applying the Debugging Strategy • Reproduce the error, understand the problem, check the obvious causes. Is this the only document that I can’t print? • Check the printer's control panel, the paper, the cartridges (ink), cable connection, file to be printed, installation of printer driver, whether others can print (if it's a shared printer) and whether you can print a different document (maybe the file is corrupted) • Simple, quick checks for obvious reasons. • If this does not solve the problem, …

  29. Pressing On • Try to isolate the problem: • Configuration is correct because you've printed before • Try printing a simple document • Think through the probable process • If the computer couldn't send the data to the printer, wouldn't it give a message to plug in the printer? • Check out the files that you want to print. • Check out the printer queue. • In the printing monitor's files, you find a list of files you've tried to print recently • Start > Control Panel> Printers and Faxes

  30. The print queue • You've found the print queue • Computer's settings may tell it to "queue" converted files rather than printing them immediately • Pause Printing • You may never know how this occurred, but you can still fix it by re-configuring the driver • Unclick Pause Printing or click Resume Printing

  31. Homework • Multiple choices: odd numbered • Short answers: 1-7 • Complete Exercises 1, 3, 7, and 8

More Related