miscon:programming.objects.variables-hold-objects · draft · trust low · v0.1.1 · kind misapplied-analogy

A variable contains the whole object

An object variable contains the object itself, not a reference to it, so every variable is its own object and passing it around passes the object.

Stable URI
https://open-misconceptions.github.io/miscon-data/m/programming.objects.variables-hold-objects
UUID
d4a1fd15-44b9-4752-b086-b9a07a1e7ae7
Domain
programming.objects
Level band
secondary, undergraduate
Locale
en
About
https://open-misconceptions.github.io/miscon-data/c/programming.objects.reference (Miscon)

Evidence patterns

Pattern 0: draw or describe memory after two variables refer to one object

draws two separate objects, one inside each variable

Itemp = Point(1, 2) q = p Draw p and q.
ExpectedTwo variables, both pointing to one Point object
ResponseTwo boxes, each containing a Point(1, 2)

Pattern 1: predict identity comparison of two variables assigned from one another

predicts they are different objects

Itemp = Point(1, 2) q = p print(p is q)
ExpectedTrue
ResponseFalse

Discriminators

vs a slip. Diagnosed by the drawing or by identity questions; the model is consistent. A slip is a single wrong prediction with a correct drawing.

vs programming.objects.assignment-copies-object. Assignment-copies is the behavioural prediction; this record is the memory model behind it. Use the drawing task to separate learners who know about references but think assignment copies from those with no reference concept.

Relations

conflicts_with
An object variable holds a reference; assignment copies the reference (external)
resolved_by
An object variable holds a reference; assignment copies the reference (external)
confusable_with
programming.objects.assignment-copies-object
programming.objects.equality-compares-contents

Alignments

Provenance

Origin: llm-drafted

  1. Chiodini, L., Moreno Santos, I., Gallidabino, A., Tafliovich, A., Santos, A. L., & Hauswirth, M. (2021). A curated inventory of programming language misconceptions. In Proceedings of the 26th ACM Conference on Innovation and Technology in Computer Science Education (ITiCSE '21), 380-386. doi:10.1145/3430665.3456343
    Inventory consulted for the misconception name and scope only; progmiscon publishes no licence for its text, so Open Misconceptions' statements and examples are written independently.
  2. Sorva, J. (2013). Notional machines and introductory programming education. ACM Transactions on Computing Education, 13(2), Article 8. doi:10.1145/2483710.2483713
    Notional machine: references versus values.
  3. Ma, L., Ferguson, J., Roper, M., & Wood, M. (2007). Investigating the viability of mental models held by novice programmers. In Proceedings of the 38th SIGCSE Technical Symposium on Computer Science Education (SIGCSE '07), 499-503. doi:10.1145/1227310.1227481

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.objects.variables-hold-objects
https://open-misconceptions.github.io/miscon-data/m/programming.objects.variables-hold-objects