## Archive for February 26, 2018

### Confusion over the forms of programming problems: Mathematics/Physics versus CS

I’m teaching Media Computation again this semester, about 250 students (over 50% female) in a huge lecture hall.  It’s hard to wander the room to answer questions, especially during peer instruction, but we do it anyways.

I’ve been thinking a lot about one question on the first quiz in week #2 of the class.  All my students are Georgia Tech undergraduates but not-CS majors, so, very smart, lots of math and science background, but almost no programming background.

Here was one of the two problems that had the lowest score. Students were to write down what this program would print.

```def computeSalary():
rate = 10.00
hours = 40
salary = hours * rate
hours = 30
print salary
increase = 1.00
salary = hours * (rate + increase)
print salary```

I suspect most teachers would think that this is a pretty standard first semester, even first couple weeks problem. I certainly did. I even discussed almost the exact same program in lecture.

The most common wrong answer was to write only what the second print statement generated. The first print statement was ignored.

During the last 5-10 minutes of the quiz, almost everyone was gone, and I answered lots of questions from the remaining students — picking my way through the narrow aisles in the lecture hall. They were struggling, so one might expect that they would try to get clues by asking questions. This was a problem that they asked lots of questions about.

I was struck by the words that students used when they described what was the one number that they were writing. One told me that the number she wrote down was the “result” of the function. Another told me that that was the “answer.” I came away with the sense that the students were thinking about the program as a mathematics function or a physics story problem.

We often talk about how computer programs might lead to misconceptions for students because of flawed transfer from mathematics. For example, Python functions have mutable data, use the “=” sign in a non-mathematical way, and have side effects. I wonder if the confusion here is about the similarity in form of the problem. Students see a series of equations in math, or a description of a situation in physics, and the answer is a number, an answer, a single result. Not so with programs — it’s a series of statements (like those others), but there may be more than one thing that the program does. We’d need to do real research to see if there is anything to this, not just me noting anecdotal comments from a half dozen students.

Join 7,142 other followers