Understanding Conceptual Transfer for Students Learning New Programming Languages by Ethel Tshukudu and Quintin Cutts
Prior work on PL transfer focuses on transfer of problem-solving strategies as experts transition from one language to the next. But we don’t know much about how PL transfer happens during code comprehension.
We’ve previously talked about how students can face difficulties transitioning from blocks-based languages to text-based languages. We have some empirical evidence for the types of programming constructs (loops, conditionals, etc.) that might trouble them, but this empirical evidence doesn’t give us much in the way of a predictive theory of how this transfer takes place and is helped or hindered. Having such a predictive theory can give us clues about the cognitive difficulties that we should pre-empt while teaching a second or third programming language.
These papers propose and evaluate such a theory of transfer of knowledge between programming languages.
Mindshift learning theory (MLT)
- Carryover concept: concept with similar meaning in the old and new contexts (PLs)
- Changed concept: concept is similar to a known concept but has a different meaning in the new context (PL)
- Novel concept: concept not already known to the learner
Learning a second natural language
We know from fMRI studies that programming languages and natural languages are related; they activate the syntactic and semantic regions of the brain. These papers draw on this relationship.
Similarity relations between languages
- Similarity relation: item or pattern in L2 is perceived as similar to a form or pattern in L1. For example, mine (English) and mein (German)
- Contrast relation: Underlying similarities between items, but important differences. For example, lecturer (English) and lektura (reading; Polish).
- Zero relation: Little-to-no perceptible relation between an item in L1 and L2. For example, talk (English) and rozmowa (talk in Polish)
Learning a second programming language
The paper suggests that knowledge of a programming language is organised into a network of interconnected knowledge structures. These knowledge structures are:
- Syntax level: Knowledge of the syntax of a known programming language. For example,
int mark = 4;
- Semantic level: The “meaning” of the syntax. For example, the variable
markis being declared as an integer and initialised to
- Conceptual level: Higher-level concepts known by the programmer. For example, variable introduction.
Notice that items #1 and #2 above are making a distinction between two skills: being able to read (trace) programming language syntax, and being able to understand the purpose of that syntax from a higher level. This hearkens back to the idea that introductory programming skills ought to be separated and sequenced.
Semantic transfer between PL1 and PL2
The paper suggests in the Prior Level, there’s no branching between the syntactic and semantic level. But this is an idealised notion—recall that there can be issues of transfer between the learner’s prior knowledge from other domains with similar tokens or notation (e.g., math). This conceptualisation largely ignores those issues, focusing only knowledge of a programming language.
When learning the second language, relationships between concepts in the two languages are formed.
- True carryover construct (TCC): Similar syntax and same underlying semantics in PL1 and PL2. (E.g., a
whileloop in Python and Java)
- False carryover construct (FCC): Similar syntax, but different semantics. Negative transfer! (E.g., integer division in Python and Java).
- Abstract true carryover construct (ATCC): different syntax by same semantics. (E.g., objects in Java are kind of like
Totally new (conceptually, semantically, and syntactically novel) constructs in the second PL will appear as brand new strands, unrelated to any known concepts.
💡 I’m a bit skeptical of the example for ATCC above. But maybe with the introduction of Records in Java, this example holds a bit better. A better example might be semantics for
How does this affect PL knowledge transfer?
The authors make three predictions:
- When a TCC is encountered (i.e., a concept which has similar syntax and semantics in PL1 and PL2), the learner correctly perceives the similarity between the concept in the two languages. Positive knowledge transfer takes place.
- When a FCC is encountered (i.e., a concept which has similar syntax, but different semantics in PL1 and PL2), the learner incorrectly perceives that there is a similarity between the concept’s semantics in the two languages. That is, the learner thinks this is a TCC. Negative knowledge transfer takes place.
- When an ATCC is encountered (i.e., a concept with similar semantics but different syntax in PL1 and PL2), the differing syntax between PL1 and PL2 masks the concept’s similar semantics from the learner, and they fail to transfer that understanding from PL1 to PL2. They therefore perceive the ATCC as a totally new concept. No knowledge transfer takes place.
❓ Think about the first two programming languages you learned. For many of you, this will have been two quarters of Python followed by Java. What aspects of this model hold for you? What doesn’t hold?
How does this theory hold up?
- H1: No difference in quiz scores for concepts involving TCC between PL1 and PL2
- H2: PL2 scores will be lower for concepts involving FCC between PL1 and PL2
- H3: PL2 scores will be lower for concepts involving ATCC between PL1 and PL2
Study 1: Python → Java
Results largely hold up.
Example of inappropriate semantic transfer:
# This doesn't work in Python print("Friday is no: " + 1)
// Participants expected this to not work in Java System.out.println("Friday is no: " + 1);
Study 2: Java → Python (IT students; exposure to Java the prior semester; non-CS undergraduate degrees; more advanced level of learning Python than the Study 1 participants were at learning Java)
Results kind of hold up.
❓ It appears that transfer from Java to Python was easier than transfer from Python to Java. Why do you suppose this is?