Variable Evaluation

Author:

Abstract
For novice programmers one of the most problematic concepts is variable assignment and evaluation. Several questions emerge in the mind of the beginner, such as what does x = 7 + 4 or x = x + 1 really mean? For instance, many students initially think that such statements store the entire calculation in variable x, evaluating the result lazily when actually needed. The common increment pattern x = x + 1 is even believed to be outright impossible. This paper discusses a multi-year project examining how high school students think of assignments and variables. In particular, where does the misconception of storing entire calculations come from? Can we explain the students' thinking and help them develop correct models of how programming works? It is particularly striking that a model of the computer as a machine with algebraic capabilities would indeed produce the observed misconceptions. The misconception might simply be attributed to the expectation that the computer performs computations the exact same way students are taught to in mathematics.

This publication has 12 references indexed in Scilit: