miscon:programming.variables.variable-keeps-history · draft · trust low · v0.1.1 · kind misapplied-analogy

A variable remembers every value it has held

A variable stores every value ever assigned to it, so an earlier value can still be read out later.

Stable URI
https://open-misconceptions.github.io/miscon-data/m/programming.variables.variable-keeps-history
UUID
1ee84937-cc32-4577-ae23-3d6e015807c3
Domain
programming.variables
Level band
secondary, undergraduate
Locale
en
About
https://open-misconceptions.github.io/miscon-data/c/programming.variables.variable (Miscon)

Evidence patterns

Pattern 0: trace repeated assignment to one variable and then use it

uses an earlier value, or sums the values, instead of the most recent one

Itemx = 3 x = 5 print(x)
Expected5
Response3 5 (or 8)

Pattern 1: accumulate in a loop

expects the variable to hold the list of values seen rather than the running total

Itemtotal = 0 for n in [1, 2, 3]: total = total + n print(total)
Expected6
Response1 2 3 (or 0 1 3 6)

Discriminators

vs a slip. Consistent across items; the learner talks about the variable 'having' several values. A slip is a single wrong trace step.

vs programming.control.loop-body-variables-reset. Resetters lose values between iterations (total becomes 3); history-keepers retain too many.

Relations

conflicts_with
A variable holds exactly one value at a time (external)
resolved_by
A variable holds exactly one value at a time (external)
Assignment copies a value into a variable at one moment (external)
confusable_with
programming.control.loop-body-variables-reset

Provenance

Origin: llm-drafted

  1. du Boulay, B. (1986). Some difficulties of learning to program. Journal of Educational Computing Research, 2(1), 57-73. doi:10.2190/3LFX-9RRF-67T8-UVK9
  2. Bayman, P., & Mayer, R. E. (1983). A diagnosis of beginning programmers' misconceptions of BASIC programming statements. Communications of the ACM, 26(9), 677-679. doi:10.1145/358172.358408
  3. Sorva, J. (2012). Visual Program Simulation in Introductory Programming Education (Doctoral dissertation, Aalto University). Appendix A catalogues introductory programming misconceptions from the literature. link

Drafted from the cited literature for the Open Misconceptions seed pack; statement, examples and discriminators are original text. Awaiting maintainer review.

Review status

Status draft, trust low (computed from the reviews below against the reviewer registry).

No reviews yet.

Formats

Cite

miscon:programming.variables.variable-keeps-history
https://open-misconceptions.github.io/miscon-data/m/programming.variables.variable-keeps-history