Thursday, January 3, 2013

Pedagogical benefits of bottlenecks

Back in the day of my initial computer programming classes we used punch cards ( One card held one line of computer code, so that a 100-line program, which is a small program, required a deck of 100 cards.

To prepare and run my program required I get in a line for the next available key punch machine -- I typed my program out on a keyboard and coded holes were punched into cards. I might have to wait 30 minutes for a free machine on the night before an assignment was due, then taking another 15-30 minutes to punch my cards. When I was done, I went to another line, with a 5-10 min wait, and ran my deck through the mainframe-computer's card reader -- it flipped through the card deck like a card shark flips through playing cards, reading the holes in the cards as they sped by. After this, my program waited in the computer's internal queue until its turn came, about 20 minutes, and the computer "ran" (aka executed) my program, printing out the results *IF* my program "worked" (but, sigh :-( even then the results or OUTPUT was often wrong, a result of semantic or "runtime" errors), or the "line" printer (a massive thing that printed on large rolls of paper) would print out my program, flagging syntax errors that had prevented my program from running at all. If this all seems like a drag, it wasn't really -- the night before an assignment was due was a party -- computer science was probably the most social major on campus. More recently than back-in-the-day, personal laptops have come to dominate and students often work in their dorm rooms (sigh), but I hope that computer science education is as social as it once was, albeit in different forms.

The simple physical operations that I had to perform to correct and run my program and get the results back was about (45min+5min+20min =) 70 minutes on a busy night!! Before I got back in that line for the key punch machine, I rolled out my printout and studied it for at least 30-60 minutes, maybe longer, maybe much longer -- if I found the bugs that appeared to be the problem, I didn't stop there, but studied the entire program looking for more, because there surely were more bugs and its usually the case that the "real bug" is NOT in the vicinity of its manifestation. No professor or textbook berated me to take a global view of the code, to go beyond the immediate symptoms and look for causes -- it was the time bottleneck, the 70 minute response time, that encouraged, even demanded extensive thought on my part. In writing even a several-hundred line program, I actually ran the program only a handful of times.

Since back-in-the-day, programming development environments have gotten much better and computer response times have decreased drastically. A student can make a change to a program, hit "run", and have the results of the run back before they've finished blinking, at least for the programs of complexity that novice-to-intermediate students will run (in contrast, while in grad school and not that long ago as a faculty member, I wrote and ran programs that might take a week).

But lesser response times (i.e., faster) and friendlier programming environments are not all good news -- not for novice programmers trying to become expert anyways, though they might think otherwise. Unfortunately, it seems that the decrease in response time is accompanied by a decrease in thought time. The removal of a time bottleneck encourages a local change, hit run to see what happens, change, run, change, run, change, run ... anyways, this is my experience as an instructor. A student might (try to) run the program a hundred times using this knee-jerk debugging strategy, and because the strategy focuses on local changes, not benefiting from reorganizations that stem from a global view, the code is far less elegant and more brittle.

Among the experienced programmer, fast response is a godsend, but its a bane to the novice programmer in training, whether the student knows it or not.

I want to know whether this correlation between computer response time and programmer think time is really true, particularly among novices. And I'm very concerned with what analog correlations exist with other technologies and the influence of such correlations with respect to human sustainability.

When I have the time, so wonderful to think about (having time), I'll be contemplating bottlenecks, how they promote the long view, the global view, particularly as they relate to computing and sustainability. I like the idea of bottlenecks that actively teach and reason with you, even as they slow you down -- another note.

BTW -- one of the greats in CS, Edsger Dijkstra, went so far as to suggest that the new CS programmer shouldn't be able to access a computer for a year, so I recall. You ought to be able to write correct code for even complicated tasks without getting feedback from a computer at all -- amazing, but I believe it.

(originally posted on Wordpress blog: May 20, 2009)

No comments:

Post a Comment