It’s an attractive theory for some learners to “learn by reverse engineering”. Anecdotally we have seen consistently over the years that this is not very effective, but I wanted to see what the research says.
Unfortunately, the strategy of “learning by primarily reading” isn’t well studied. Most studies involve university students and programming learning coursework requires students to actually write code. So, I’m left pulling relevant pieces out of related studies.
Hopefully, this summary of various research is useful to learners on the forum.
The tension between exploratory (constructivist), making (constructionist) and direct teaching needs to be quickly addressed. Teachers are currently presented with a plethora of educational technology resources that lack pedagogical instruction. Research with university students indicates that targeted pedagogies teaching specific skills such as tracing code and subgoal modelling are essential to successful programming learning. Emerging research with school aged pupils indicates that a blended pedagogy, including guided exploration, targeted tasks and creative open problem solving provides a more effective learning scenario. However, these indications need to be verified in UK school settings in rigorous studies.
I think the big picture here is important. They do not have conclusive evidence on what is the best way to learn from this metaanalysis, but they have evidence to conclude that a blend of both reading and writing, with code tracing and open ending problem solving, is important.
This is consistent with our recommendation to many learners that they should both solve coding challenges (with help as needed) and read solutions other people have written. I always recommend reading solutions after writing solution since having the answer fundamentally changes the experience of trying to write the answer.
We investigate to what degree novice programmers manifest the ability to work with this concept of reversibility by providing them with a small piece of code and then asking them to write code that undoes the effect of that code. On testing entire cohorts of students in their first year of learning to program, we found an overwhelming majority of them could not cope with such a concept.
In this study, new learners struggled to comprehend enough of the logic to correctly reverse the logic of a small snippit of code. I think this is a negative indication for the ability of learners to be able to effectively understand more complex algorithms without better code writing and comprehension skills. In this study, learner skill in reading actually increased as they did more reading and writing.
A correlation was also found between performance on “explain in plain English” tasks and code writing. A stepwise regression, with performance on code writing as the dependent variable, was used to construct a path diagram. The diagram suggests the possibility of a hierarchy of programming related tasks. Knowledge of programming constructs forms the bottom of the hierarchy, with “explain in English”, Parson’s puzzles, and the tracing of iterative code forming one or more intermediate levels in the hierarchy.
This paper is suggesting that code tracing is actually a higher level skill than writing code for more simple problems, which jives with my observations.
We found that students prioritize the output that is generated by print-statements in a program. This is indication that these statements may have the ability to aid students make sense of code. Furthermore, students appear to be selective about which elements they find important in their explanation. Assigning variables and asking input was less often included, whereas control-flow elements, print statements and function definitions were more often included. Finally, students were easily confused or distracted by lines of code that seemed to interfere with the newly learned programming constructs.
Two things stand out to me here.
console.log is a helpful tool, which matches my observations. Synthesizing control flow into the intent is hard, which also matches my observations.
The results suggest that efforts to improve reading skills could have a positive impact on learning to program.
As an interesting note here - fundamental reading skills seem to be important in learning programming. This probably is not surprising to anyone? Careful reading and understanding of tasks and documentation is a common theme in our recommendations.
Overall, I think our recommendation that reading and writing code are important but separate programming skills is pretty consistent with the body of research out there. It seems to me that learners should focus on both and should not focus on one (like reading) at the expense of the other.