DOC PREVIEW
NJIT CS 103 - An Introduction to Debugging

This preview shows page 1-2-3 out of 9 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyFluency with Information TechnologyThird Editionby Lawrence SnyderChapter 7: To Err Is Human: An Introduction to Debugging7-21-2Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyPrecision: The High Standards of IT• Precision in Everyday Life– Many people say "oh" rather than zero when giving a phone number– 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 it7-31-3Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyExactly How Accurate Is "Precise?"• Modem or database software can be programmed to make "oh" to zero corrections automatically because all digits will always be numbers• In e-mail programs, both letters and numbers are allowed, so the computer can't be programmed to auto-correct. Users have to be careful7-41-4Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyLexical Structures• Field Inputs: Information entered into boxes/forms on screen– 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.• May also be loose, allowing any sequence of symbols of any length7-51-5Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyDebugging: What's the Problem?• Debugging: The method of figuring out why a process or system doesn't work properly– Usually learned from experience• Debugging in Everyday Life: People troubleshoot problems such as why their cars don't start– Usually involve working system with broken or worn-out part• Debugging in Information Technology: – Working system might have wrong data or wrong configuration information or– There might be a logical design error– We will always begin by assuming a correct, working system7-61-6Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley7-71-7Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyWhose Problem Is It?• When we debug an information system, we are always part of the problem– We give the commands and the input• Operator or pilot error– Only other possible cause is broken system• People don't knowingly make errors– We may think we did everything right because we misunderstand the system7-81-8Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyUsing the Computer to Debug• A computer can't debug itself• We can't debug it directly, either• Error is internal to the computer– To get information about the error, we have to ask the computer what data it stored, etc.• With faulty software we cannot fix, try to bypass error with alternative approach (workaround)7-91-9Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyA Dialog About Debugging• Debugging is solving a mystery– Whatdunit vs. whodunit• Ask purposeful questions like:– Do I need more clues?– Are my clues reliable?– What is a theory to explain the problem?• Better than aimlessly "trying stuff"7-101-10Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyDebugging (cont'd)• Steps to follow:1. Check that the error is reproducible2. Make sure you know what the problem is• If no mailing labels come out of printer, problem may be with printer or with program sending labels to printer or file containing addresses3. Check all the "obvious" sources of error4. Isolate the problem• Divide operation into those parts that are working and those that are not working• Think objectively—ask yourself if you've made a wrong assumption, etc.7-111-11Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley7-121-12Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyDebugging Recap• Make sure you can reproduce the error• Determine exactly what the problem is• Eliminate "obvious" causes (Is it plugged in?)• Divide the process, separating out the parts that work from the part that doesn't (isolate the problem)• When you reach a dead end, reassess your information; then step through the process again• As you work through, make predictions about what should happen and verify that they are fulfilled7-131-13Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyButterflies And Bugs: A Case Study• Imagine we've developed a simple HTML page• Following is our goal page:7-141-14Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyOur Goal Page:7-151-15Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley7-161-16Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyThe Actual Display in IE:7-171-17Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley7-181-18Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyButterflies and Bugs (cont'd)• Displaying the page in Safari and Mozilla also produces errors– Test in multiple browsers!• We can study the HTML very closely and "brain out" where the error is• We will use the debugging strategy7-191-19Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyButterflies and Bugs (cont'd)• First, be sure we can re-create the error– Reload the page– In this case, the results are the same• Next, determine the problem exactly– Look at the displayed page and determine where the errors occur– Since there are multiple errors on different parts of the page, assume they are caused by different mistakes in the HTML• Try to fix first/top error on page first; save and refresh browser7-201-20Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyThe HTML for Our Page7-211-21Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-WesleyButterflies and Bugs (cont'd)• Next, eliminate the obvious– In HTML, most common error is forgetting to close a tag• For example: <b> with no closing </b> tage– Make sure all quotes match (open and close)• In this case, the word Blues appears in red on the page. Why? <caption><b><font color=blue">Blues</font>• Missing opening quotation mark around the attribute value "blue"– Why is the "More here" link not highlighted?• Space missing between <a and


View Full Document
Download An Introduction to Debugging
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view An Introduction to Debugging and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view An Introduction to Debugging 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?