# The Nature of Variables for Students vs. Programmers

Dan Meyer has provoked us again with this post questioning the meaning of variables in programming compared with how they exist in the minds of our students.

I previously wrote about something I tried at the beginning of last year with my students that probed this question a bit. My contention then was that writing expressions is something that occurs with students only in math class world, and that it is an inherently non-interactive process. The spirit of what variables do is something with which students have familiarity. It’s the abstraction of the mathematical representation that pushes that familiarity away from them.

I’m going to use a different expression problem since the one in Dan’s post doesn’t do it for me.

### Dan estimates that around 3/4 of any group of people drink soda. Students could each click on the people go through the process of figuring out how many in each group drink soda according to Dan’s estimate, and would record the number in each group. The third group serves to construct a bit of controversy for discussion purposes. In doing this four times, students are presumably going through a similar process each time.

Mathematics serves to create structure for this repetition, but on its own, is not necessarily in the realm of what our students would do to manage this repetition. Programming provides a way to bridge this gap using the same idea of variables that exists in the mathematical realm, and here is where the value sits for this discussion.

In the post I mentioned previously, I said that I briefly showed students how to type expressions into a spreadsheet and play around with inputs and outputs so that they match concrete values. In a non 1:1 laptop classroom, I might start with this: A calculation links the outputs to the inputs in each of these tables. Students have concrete values sitting in front of them, so they will notice that each of these tables must be making the wrong calculations, even though they each have one correct value. Here, we have the computer making the same calculation each time, but these calculations do not work in each case. This is the wrong model to match our data. The computer is doing exactly what we are telling it to do, but the model is wrong.

How do we fix this, class? Obviously we use a different computational model. I might have students decide in a group what calculation I need to do to correctly reproduce the values from the exercise, and elicit those suggestions from them.

Once we establish this correct model, this calculation we are making is common to every set of data. We can show that this calculation makes an interesting prediction of 7.5 people liking soda in the group of 10. We can use this calculation to predict how many people in a group of 28 drink soda (and in a 1:1 classroom, I’d have them go through this entire programming process themselves.)

I might now generate a table hundreds of entries long and ask whether there is a better way to represent the set of all possible answers to this question. The table will work, but it is tedious. We need a better way. How do we do this? Here is where variables come in.

Programmers use variables because they want to build a program that produces a correct output for every possible input that might be used to solve a given problem or design. Mathematicians also want to have the same level of universality, and have a syntax and structure that allows for efficient communication of that universality. Computers are really good at calculating. The human brain is really good at managing the abstraction of designing those calculations. This, ultimately, is what we want students to be able to do, but they often get lost in both the design stage and the calculation stage, especially because these get divorced from the actual problem students are trying to solve.

If we can have students spend more time in the design stage and get feedback on whether their calculations are correct, that’s the sweet spot for making the jump to using mathematical variables.

## 3 thoughts on “The Nature of Variables for Students vs. Programmers”

1. Cleargrace says:

So you’re saying: let the students work with the problem/question and come up with solutions, then present a series of solutions from a calculator, some wrong and some right, explore the calculations made by the program (that you put in beforehand) and correct those. Then create a whole list of answers for the question, and then ask students to identify a universal equation that would suffice to provide every answer to the question. (Let me know if I have missed anything). I like this idea because it feels more like a connection is being made between the equation/variable and the question when it becomes necessary.
I am teaching Alg II this year. I can use this! I also like the use of spreadsheets. We are not 1:1, but we are BYOD. I want my students to utilize some of the tech tools, and spreadsheets should be a familiar way to begin (I say should – who knows what they have used in other classes!) good blog!

1. Evan Weinberg says:

You are close in your description – I’d get away from even asking them for solutions, and instead ask them to come up with concrete answers to the questions posed using conversational language rather than mathematical. Then, as we repeat the process with different concrete examples, the mathematical tools become more useful to manage the repetition. The end product is the algebraic expression.

Spreadsheets are definitely a low barrier of entry tool here. Students have seen them before, have presumably used them to make graphs for science (which carries its own issues), and seem to catch on pretty quickly.