Csc 216/s08/high virtue: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
===The Problem===
===The Problem===


A simple example program is given [[Image:side1.jpg]]here but many more could be designed.
A simple example program is given [http://pg-server.csc.ncsu.edu/mediawiki/index.php/Image:Side1.jpg]here but many more could be designed.


===Participants and Props===
===Participants and Props===

Revision as of 21:44, 25 March 2008

Interactive Debugging

This exercise illustrates stepping through a program line by line to debug it.

The Problem

A simple example program is given [1]here but many more could be designed.

Participants and Props

This exercise will require members of the class to act as lines of codes and one to be the programmer/ debugger. Cards with code on one side and comments on the other should be prepared before class. An example of a card for this program is below.


The Script

Pick one student to be the programmer. Pick other students to represent lines of code, as many students as cards. It would be helpful to display the entire program on a screen for the whole class to see.

The programmer should place a flag where they think the program's problems start, likely with the first line of code represented by a student. Model this by having the student lines of code pass a ball or flag. The programmer should be able to read the comments on the card but not the code which is on the back side of the card. The programmer can ask the student line of code for the current value of any variables of interest, in this example, x. If the value is not what is expected, the programmer will know to change this line of code. When satisfied with one line, the programmer should ask to step to the next line. The student line of code will then pass the ball/ flag to the next student line of code. Again, the programmer can ask for the current value of any variables. Continue stepping through the program and editing lines as you move along until the end is reached. The programmer will need to try several inputs to ensure all bugs are removed.