11.07.2015 Views

Here - 1000 BiT

Here - 1000 BiT

Here - 1000 BiT

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

INSTRUCTOR NOTES 33 DEBUGGING, STOP, CONT uThe "sigh and moan" technique being a loser, our students need a bag of tricks which [^jhelp isolate program bugs, and should practice on programs they are writing as they gothrough this book. ^JThe inexperienced debugger feels hopeless inertia when "it doesn't work right." Rather ^than sit and stare, it is more useful to try some changes. Any changes are better than ^none, but random changes are very inefficient. The best changes are those which eliminatesections of the program from the list of possible hiding places for the bug. ^jAs programs grow in complexity, more of the bugs result from unforseen interactions Obetween separated parts of the program. The bag of tricks we offer helps find these also.Delay loops, PRINT commands and STOP statements help the student see how the ^program is functioning. t,Don't overlook those techniques you can use after the program is stopped with a STOP ^jstatement or a STOP key press. You can PRINT out any variable values you like so as tosee what the program has done. You can also do arithmetic in the PRINT command to ^Jcheck what the program should be doing. You can even change variable values (forexample, the value of a loop variable). When you are ready, CONTinue the program run. ^QUESTIONS:w1. How can you make the computer print ^JBREAK IN LINE 55 ^by adding a line in the program?2. How are the STOP and the END commands different?3. How are the STOP command and the STOP key different?4. What does the CONT command do? ^5. Why would you put STOP commands into your program? k^j6. How do delay loops help you debug a program? ^J7. How do extra PRINT commands help you debug a program? ^8. Why do you take the STOP and extra PRINT commands out of the program after youhave fixed the errors?^j9. Can you pick in what line the STOP key will stop the program? Can you pick using ^the STOP command?190

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!