miscon:programming.objects.assignment-copies-object · draft · trust low · v0.1.1 · kind overgeneralization

Assigning an object makes a copy

Assigning one object variable to another makes a second, independent copy of the object, so changing one does not affect the other.

Stable URI
https://open-misconceptions.github.io/miscon-data/m/programming.objects.assignment-copies-object
UUID
bf369c82-773c-4072-950c-55b6d9464684
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: trace a mutation through an aliased object

reports the other variable's object as unchanged

Itema = [1, 2] b = a b.append(3) print(a)
Expected[1, 2, 3]
Response[1, 2]

Discriminators

vs a slip. Consistent across items with mutable objects, and the learner is surprised by the result. A slip is a single wrong trace.

vs programming.objects.variables-hold-objects. Same observable error; variables-hold-objects is the underlying model (the variable is the object). Ask the learner to draw a and b: two boxes with contents versus two arrows to one object.

vs programming.variables.assignment-links-variables. The primitive mirror image. Test with an int item and a list item.

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.variables-hold-objects

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. 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
    Non-viable models of reference assignment.
  3. Holland, S., Griffiths, R., & Woodman, M. (1997). Avoiding object misconceptions. In Proceedings of the 28th SIGCSE Technical Symposium on Computer Science Education (SIGCSE '97), 131-134. doi:10.1145/268084.268132

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