Break it! Confrontational thinking in computer science

:: Programming Languages, Teaching

By: John Clements

So here I am grading another exam. This exam question asks students to imagine what would happen to an interpreter if environments were treated like stores. Then, it asks them to construct a program that would illustrate the difference.

They fail, completely.

(Okay, not completely.)

By and large, it’s pretty easy to characterize the basic failing: these students are unwilling to break the rules.

I feel like this idea has been hitting me over the head for a couple of months, now, so I’m going to write it down. Specifically, I see many areas of computer science where it’s important to engage in what I call “confrontational thinking.” Taking something that looks good, and poking holes in it to find out what’s wrong with it.

Is this what other people call “critical thinking”? I don’t think so. Associations are important, and I think that the term “critical thinking” now simply refers to a watery desire for students to somehow be more well-rounded and high-level thinkers. I’m thinking of something different.

For me, I think this skill is most closely affiliated with Math. Specifically, if you want to succeed in Math (and no, I don’t mean the ability to memorize and deploy the closed-form solution to quadratics), you need to be able to take a nice idea and bash it against the wall. Find counterexamples, think outside the box. Try to prove your professor wrong. All kinds of interesting things fall out when you disassemble the nice clean theorems that you’re given.

In programming, this may be even more important. In programming, after all, the artifacts are not theorems given to you by teachers (and proven by Euclid)—they’re programs you wrote yourself, and they’re probably jammed with bugs. If you can’t attack your program, and try to break it, you’re going to develop fragile artifacts that work only for the corner that your mind was stuck in.

In the classroom, this is how you learn. Students that patiently absorb all of the text on the board don’t appear (to me) to actually be learning anything; it’s those that are in your face—as long as they can clearly enunciate their questions—that are assembling knowledge.

I was reminded of this by watching one of Veritasium’s excellent youtube posts, this one on discovering the rule that generates a sequence of numbers. Excellent, I should say, except that I wanted to shout at the people in the video. Go take a look to see what I mean. These people are having a lot of trouble engaging in confrontational thinking.

Why do students have such trouble with this?

I think that one reason may be that we learn different kinds of things in different ways.

So, for instance, consider learning to walk. This is something we learn very early, long before we’re able to absorb complex instructions. We’re certainly partially hard-wired for this, but a big chunk of it is trial and error.

Here’s the point, though. Once we learn to walk, do we engage in confrontational thinking about the process? Heck no! Deliberately try to walk wrong, to see what happens? I’m pretty sure I can accurately guess what’s going to happen, and it’s probably going to involve bleeding and bandages.

For this kind of activity, confrontational thinking is not the best idea. Instead, we find the way that works, and we stick with it.

More generally, this is the way that we actually get things done in our lives. If every morning I decide to question the way that breakfast works—whether I can fry an egg without a pan, or whether the food needs to go in my mouth—I’m going to end up messy and frustrated.

For many of our students, I claim, programming is like this. After many painful episodes of trial and error, they’ve developed scars and bruises, and know of one narrow path that happens to work pretty well. Getting them to consider other paths is frightening and aversive. (Say, for instance, the parenthesized syntax of lisp-like languages.)

In fact, if you want to really go overboard, you can compare these two learning styles to the notions of conservatism and liberality. The conservative style gets the job done, using fewer resources and taking fewer risks. The liberal style involves self-doubt and failure, but is ultimately necessary in order to learn.

Hmm… when I put it that way, it sounds perfectly obvious.

Now, the only question is how to get the students to engage, and start questioning me.