What makes programming hard is the model, not the syntax
HCI1102 · Unit 1 of 10
Novice failure is caused by an incomplete mental model of the machine and of how programs compose, not by syntax, so instruction that front-loads language features teaches around the difficulty rather than to it.
What makes programming hard is the model, not the syntax
Ask a beginner why their program failed, and they will name a missing semicolon, a wrong bracket, or a forgotten return. The errors that survive the first week rarely come from the notation. They come from a mistaken picture of what the machine does when nobody is watching. Which value does a name refer to, what has already happened by the time a line runs, and why can two names reach one object? This unit argues that the failure lies in the model of the machine, and in how programs compose. Unit 2 narrows that model to the names a program uses and what they cost. A course that front-loads language features therefore teaches around that difficulty, not to it. The strongest counter-argument, taken up below, is that learners arrive with working models already, so context and prior knowledge may carry more of the burden than this unit's title allows.
The difficulty has a name
du Boulay (1986) gave the difficulty a name: the notional machine, the learner's model of what the computer does when it runs a program. Treating the terminal as the machine, rather than as a window onto it, is one error that follows. Reading x = x + 1 as an equation to be solved, not a value to be stored, is another. du Boulay drew a blunt consequence: the machine model is a subject in its own right, and it does not emerge from practice on its own.
The mistakes have a shape. Pea (1986) sorted novice conceptual bugs into three classes: parallelism, intentionality and egocentrism. Each class follows from one default assumption, that the language understands what the writer meant. The beginner who expects the program to hold several things true at once is not careless, and neither is the one who expects it to know which object is meant. Both run a consistent and wrong model of the machine. These bugs span languages and ages, so changing the language does not remove them.
Sorva (2013) turned the idea into something teachable. He surveyed work on misconceptions, mental models and threshold concepts, and argued that the notional machine is a major obstacle that introductory teaching rarely makes explicit. He urged teachers to name it and teach it deliberately.
What experts hold is composition, not vocabulary
Soloway and Ehrlich (1984) proposed that expert programmers carry two things. The first is programming plans, the stock fragments that implement a familiar action. The second is rules of discourse, the conventions that govern how plans fit together. Two empirical studies supported the claim: experts comprehended plan-like code more easily than code that broke those conventions. What experts hold is a model of composition.
A plan is a shape, not a line of code. Take the running total. It visits each item once and folds the item into an accumulator: set the total to zero, loop over the items, add each item in turn. An expert reads those steps as one unit, and a novice reads three unrelated statements and loses the relation between them. The studies measure comprehension speed, so they show that plans organise reading, not that every expert holds the same catalogue of plans.
The scale of the failure, and it is not syntactic
McCracken and colleagues (2001) built a common assessment of whether students can program, and ran it across four universities. On 216 students finishing an introductory course, the average score was 22.89 out of 110. These students had passed, and they still could not reliably program.
Which parts defeat them is known too. Lahtinen, Ala-Mutka and Jarvinen (2005) surveyed 559 students and 34 teachers. Recursion, pointers and references, and abstract data types were rated the hardest concepts; variables and loops were rated near the easy end. Designing a program, dividing functionality into procedures, and finding bugs in one's own code were rated the hardest activities. Every hard item requires a model of the whole, and none of them is a spelling of the language. The samples are students on formal courses, so they leave the older or self-taught learner to meet the same wrong model unmeasured.
The deficit shows up as tracing
If the missing model is real, it should show in the simplest task that depends on it: reading code and saying what it does. Lister and colleagues (2004) tested students in seven countries. A large share were weak at predicting the outcome of a short piece of code, and weaker still at choosing the missing lines for a near-finished program. A total starts at zero, and a loop adds each of four numbers to it in turn. What does the total hold after the second pass, after the last pass, and as the loop variable changes? Answering needs only the intermediate state the machine reaches, which is what the notional machine supplies. Lister's group read the widespread failure as a fragile grasp of a prerequisite for problem solving, not as a lack of talent: tracing underpins writing. These questions test reading, so they locate the weakness, and they do not show that teaching tracing fixes it.
Front-loading problem solving can prevent the model forming
Sweller (1988) supplies a mechanism: a course can teach around the difficulty and make it worse. Cognitive load theory holds that conventional problem solving, and means-ends analysis above all, consumes the working memory that building a schema needs. Give a novice an equation that a taught procedure fits, and they isolate the unknown in two moves. Give the same novice one the procedure does not fit, and they try operations until a value holds, carrying several attempts at once. That search occupies the memory the schema needs. A beginner handed hard problems before holding a model therefore spends attention on search rather than understanding. Explaining the machine is not a soft prelude to the real work: it is what makes the real work legible.
Learners bring a model, and context is a second lever
A missing model is not the same as no model. Pane, Ratanamahatana and Myers (2001) asked non-programmers to write solutions, and classified the statements they produced. The largest share were event-based rules beginning with when, if or after. Declarative constraints about what must always hold next were also common, and imperative sequences were the smallest share. Learners therefore arrive with a usable model, and the language asks them to translate it.
Guzdial (2015) presses the strongest counter, and moves the lever off the machine. Learner-Centred Design of Computing Education argues that computing education should be built around learners, their interests and their contexts, and it shows media-computation courses that situate programming in a domain students already care about. On that view what matters most is what the program is for, not the explanation of the machine.
Contested question: is the missing machine model the whole story?
The literature disagrees about what the deficit is, and the disagreement is about causes rather than remedies. One camp holds the specific position: beginners lack a model of execution, and instruction should make that model explicit (du Boulay, 1986; Pea, 1986; Sorva, 2013). Its strongest evidence is Lister and colleagues (2004), who tested students in seven countries and framed the study as a test between this account and a broader one. That evidence is cross-sectional. It locates a weakness in tracing, and shows the weakness travels with poor problem solving, but it does not show that teaching a notional machine removes either.
The rival camp holds that the deficit is broader. McCracken and colleagues (2001) framed their multi-national assessment around whether students can program at all, and 216 students who had passed averaged 22.89 out of 110, which no single missing mechanism explains. Guzdial (2015) names a different cause: material set remote from learners' interests. Pane, Ratanamahatana and Myers (2001) narrow the gap from the other side. Fincher and colleagues (2020) then make both camps harder to test. Their working group defined the notional machine, set out its definitional characteristics, reviewed how the term has been used, and reported teachers using several machines in sequence. If the prescription is to teach the model, the model itself is not yet settled.
The decisive study takes two matched cohorts and gives one group explicit notional-machine instruction and the other none, holding syntax and domain context constant. It measures whether the treatment group can trace unfamiliar code, and whether any advantage survives into writing. A second test holds the machine instruction constant and varies only how far the problems sit from learners' interests. Until such studies exist, a teacher should name one machine explicitly, check that students can trace with it, and treat it as a declared simplification to revise rather than as the truth. Guzdial's position then survives as a warning about which problems to set, not as a licence to leave the machine unstated.
Where the argument is heading
The newest evidence changes the setting without settling the question. Nguyen and colleagues (2024) studied 120 beginning coders across three institutions. They found that beginners struggle to write and edit prompts even for problems at their own level, and to judge whether the generated code is correct. Stating intent and verifying output has moved up a level. Kazemitabaar and colleagues (2023) traced 33 learners aged 10 to 17 through 45 Python tasks with a Codex-based generator, and found four ways of using it, from asking once for a whole solution to building parts step by step. Prather and colleagues (2024) then watched 21 beginners working with generative tools, and the outcome split by the learner rather than by the tool: those who were coping accelerated work they already understood, while those already struggling had their difficulties compounded and finished believing they had done better than they had. Generation does not supply the missing model, and it can hide its absence from the student who most needs it. Which approaches build a notional machine and which conceal its absence therefore remains the question, and the concealment itself is now documented.
The sources this unit rests on
- 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 Traced novice errors to a missing notional machine and to misapplied analogies such as treating the terminal as the machine. Supplies the unit's core concept: the machine model has to be taught.
- Pea, R. D. (1986). Language-independent conceptual bugs in novice programming. Journal of Educational Computing Research 2(1), 25-36. doi:10.2190/689T-1R2A-X4W4-29J2 Sorted novice bugs into parallelism, intentionality and egocentrism, each resting on a belief that the language understands intent. Shows the difficulty is language-independent.
- Soloway, E. and Ehrlich, K. (1984). Empirical studies of programming knowledge. IEEE Transactions on Software Engineering SE-10(5), 595-609. doi:10.1109/TSE.1984.5010283 Reported two comprehension studies supporting programming plans and rules of discourse. What experts hold is a model of composition, not more syntax.
- McCracken, M., Almstrum, V., Diaz, D. et al. (2001). A multi-national, multi-institutional study of assessment of programming skills of first-year CS students. ACM SIGCSE Bulletin 33(4), 125-140. doi:10.1145/572133.572137 Ran a common assessment at four universities, where 216 students finishing an introductory course averaged 22.89 out of 110. Gives the scale of the failure.
- Lister, R., Adams, E. S., Fitzgerald, S. et al. (2004). A multi-national study of reading and tracing skills in novice programmers. ACM SIGCSE Bulletin 36(4), 119-150. doi:10.1145/1041624.1041673 Tested reading and tracing across seven countries and found many students who had passed could do neither. Puts the bottleneck at tracing.
- Lahtinen, E., Ala-Mutka, K. and Jarvinen, H.-M. (2005). A study of the difficulties of novice programmers. ITiCSE 05. doi:10.1145/1067445.1067453 Surveyed 559 students and 34 teachers; recursion, pointers and abstraction were rated hardest and basic syntax easy. Itemises the hard parts as conceptual.
- Sweller, J. (1988). Cognitive load during problem solving: effects on learning. Cognitive Science 12(2). doi:10.1207/s15516709cog1202_4 Argued that problem solving without a schema, means-ends analysis above all, consumes the working memory that schema building needs. Explains why front-loading problems blocks the model.
- Pane, J. F., Ratanamahatana, C. A. and Myers, B. A. (2001). Studying the language and structure in non-programmers solutions to programming problems. International Journal of Human-Computer Studies 54(2). doi:10.1006/ijhc.2000.0410 Coded non-programmers' written solutions and found event-based rules and declarative constraints more common than imperative sequences. Learners bring a model the language must translate.
- Sorva, J. (2013). Notional machines and introductory programming education. ACM Transactions on Computing Education 13(2). doi:10.1145/2483710.2483713 Reviewed misconceptions, mental models and threshold concepts, arguing the notional machine is an obstacle teaching rarely makes explicit. Turns the mechanism into a learning objective.
- Guzdial, M. (2015). Learner-Centred Design of Computing Education: Research on Computing for Everyone. San Rafael: Morgan and Claypool. doi:10.2200/S00684ED1V01Y201511HCI033 Argues computing education should be designed around learners, their interests and their contexts, with media-computation courses in a familiar domain. The unit's strongest counter-position.
- Nguyen, S., Babe, H. M., Zi, Y., Guha, A., Anderson, C. J. and Feldman, M. Q. (2024). How beginning programmers and code LLMs (mis)read each other. CHI 24. doi:10.1145/3613904.3642706 Studied 120 beginners across three institutions writing prompts for a code generator, and found intent and verification hard at their own level. Asks whether generation removes the difficulty or hides it.
- Kazemitabaar, M., Hou, X., Henley, A., Ericson, B. J., Weintrop, D. and Grossman, T. (2023). How novices use LLM-based code generators to solve CS1 coding tasks in a self-paced learning environment. Koli Calling 23. doi:10.1145/3631802.3631806 Traced 33 learners aged 10 to 17 through 45 Python tasks with a Codex-based generator, from asking once to building step by step. Sharpens whether generation builds the model or bypasses it.
- Prather, J., Reeves, B. N., Leinonen, J., MacNeil, S., Randrianasolo, A. S., Becker, B. A. et al. (2024). The widening gap: the benefits and harms of generative AI for novice programmers. ICER 24. doi:10.1145/3632620.3671116 Watched 21 beginners with generative tools; the coping accelerated work they understood, while the struggling had their difficulties compounded and finished with an illusion of competence. Shows generation can conceal the missing model.
- Fincher, S., Jeuring, J., Miller, C. S., Donaldson, P., du Boulay, B., Hauswirth, M. et al. (2020). Notional machines in computing education: the education of attention. ITiCSE-WGR 20, 21-50. doi:10.1145/3437800.3439202 Defines the notional machine, reviews how the term has been used, and reports teachers using several machines in sequence. The construct is looser than teaching advice assumes.