A brief overview of theories of learning to program



There is a wide variation in the ability of students to learn to program, and 'there is a need to understand the fundamental causes that make [advanced] learners different from others, and the same applies for those students who fail to understand even the basics of the subject' (Mancy & Reid, 2004, p. ii).

This paper reviews the literature on the mechanisms of learning to program and the attributes of students with regard to their ability to acquire this skill.

Mancy, R. and Reid, N. (2004) Aspects of Cognitive Style and Programming. Proceedings of 16th Annual Workshop of the Psychology of Programming Interest Group (PPIG), Institute of Technology, Carlow, Ireland, 5-7 April 2004, 1-9.

How is programming learned?


The most common theory of how programming is learned is probably the 'schema accretion' model, wherein the student builds up a 'toolbox' of approaches to how to solve particular classes of problems. However, Davies (1994) argues for the importance of knowledge restructuring in the development of expertise. He offers empirical evidence for the changes in the structure of programming knowledge that develops with expertise. Another theory is that expert programmers have more complete schemata than novices (not just more, but fuller).

Novices tend to focus on the key words in the problem statement rather than the deep structure of the problem (Davies, 1994, p. 706). Novices also tend to work in the order of the schema that they are using (Davies, 1994, p. 707).

Davies, S. (1994) Knowledge restructuring and the acquisition of programming expertise. International Journal of Human-Computer Studies. 40, 703-725.

Mayer (1985) proposes that learning to program includes 'acquiring a mental model of the underlying (computer) system ... a mental model is a metaphor consisting of components and operating rules which are analogous to the components and operating rules of the system.' (p. 90)

Mayer, R. (1985). Learning in complex domains: a cognitive analysis of computer programming. The psychology of learning and motivation, vol 19, Academic press.

In apparent contrast to those who theorize programming in a knowledge-centric manner, some see learning to program from the standpoint of procedural planning. For example, Mayer, Dyck & Vilberg (1986) found that training in appropriate procedural models may enhance students' ability to learn programming: 'Students who were given pretraining in the output of English in procedures learned [programming] much faster than those with no pretraining ... a straightforward conclusion is the procedure comprehension is a component skill in learning [to program], and this can be taught to novices' (p. 609).

Mayer, R. Dyck, J., Vilberg W. (1986). Learning to program and learning to think: what's the connection? Communications of the ACM, July 1986, vol 29 no 7.

Student attributes


Several studies, mostly performed during the late 1980's and early 1990's, have identified various individual student attributes as significant with regard to learning to program.

An empiricist view of learning to program says that the student must have appropriate previous experiences in order to learn to program; a nativist view says that the students differ innately in their ability to learn to program (Mayer, 1985, p. 121).

The following are some of the results that researchers have concluded:

  • Students' ability in math word problems is a significant indicator of the ability to learn to program (Mayer, Dyck & Vilberg, 1986, p. 608)
  • Motivation, background, interests and programming experience all are strong indicators of success in programming classes (Prabhakararao, 2003, p. 281).
  • A student's ability to program is significantly related to his/her scores on generic tests of translating a problem statement into a formal language (e.g., as in algebra word problems) and a test of ability to comprehend a procedure (Mayer, 1985, p. 125).
  • Working memory and prior achievement in mathematics were sufficient predictors of programming ability (Lehre, Guckenberg, Sancilio, 1988, p. 102).
  • Adoption of strategies may be a function of efficiently using working memory; this also indicates that the development environment and the language selection will influence programmer behavior (Davies, 1994, p. 706).

Prabhakararao, S. (2003) Bringing educational theory to end-user programming. Proceedings of the 2003 IEEE Symposium on Human Centric Computing Languages and Environments. Oct. 28-31, 2003 pps 281-282.

Lehre, R., Guckenberg, T. and Sancilio, L. (1988) Influences of LOGO on children's intellectual development. Teaching and Learning Computer Programming: Multiple Research Perspectives, R. E. Meyer (ed), Lawrence Erlbaum Associates, Hillsdale, NJ.

The ability to learn to program is highly correlated with field independence, which is the ability for learners to 'restructure material in their own way, applying internally generated rules arising from prior experience or developed from cues in the material' (Mancy & Reid, 2004, p. iii).


The task of programming is not monolithic, however; different types of programming require different attributes. For example, learning modern object oriented programming requires different cognitive tasks than the older, procedural, programming approach (Romero, Lutz, Cox, and du Boulay, 2002).

At least since the 1970s there have been tests commercially available which purport to measure a person's aptitude for programming; however, these have not been widely used. Instead, a self-selection process has been the norm: if a student was able to persevere through a programming-oriented curriculum, the expectation has been that s/he was able to program reasonably well. However, this self-selection process loses effectiveness when grade inflation pressures allow untalented students to obtain good grades in a programming class.

Romero, P., Lutz, R., Cox, R., du Boulay, B. (2002). Co-ordination of multiple external representations during Java program debugging. Proceedings of the IEEE 2002 Symposia on Human Centric Computing Languages and Environments, Arlington, VA, USA.

Process attributes


Several aspects of the process of learning to program have come to light through research. A reasonable synopsis of this research is as follows: Students learn to program through a consecutive series of assignments which help to engender in them a mental model, consisting of either a knowledge structure, a series of plans, or both, which are then used to solve more complex problems. A 'good' mental model is one that helps novices learn to program better (Mayer, 1985 , p. 91).

The environment in which the learning occurs can either aid or hinder learning, based on familiarity and cognitive load requirements. Important environmental variables include the programming language used, the user interface, context, and the lab environment. For example, novices are often confused by the varying contexts in which the same programming language statement can be used (Mayer,1985, p. 98).


Mayer (1985) found some evidence that 'the particular formalism used for expressing procedures may affect the relative difficulty of encoding particular types of transactions' (p. 120), and Ko & Myers (2005) has a similar finding. A student must master the semantics of a programming language before s/he will be able to predict the outcome of a program and therefore effectively write programs (Fay & Mayer, 1988, p. 63). These results may point toward a programming language version of the linguistic relativity hypothesis (see Shaffer (1996) and Shaffer (1997)).

The user interface used to develop the programs during a course can have a significant effect on learning. A balance needs to be struck between two competing priorities: (1) using an interface which enables the student to learn without undo cognitive strictures, versus (2) using an ecologically valid interface which will enable the student (especially the vocational student) to actually perform programming tasks in a non-educational environment.

As already mentioned, certain user interfaces can be shown to be too mentally taxing for a novice programmer (Davies, 1994, p. 706): 'Research has demonstrated that many students have difficulty acquiring the semantic structure of the programming environment' (Fay & Mayer, 1988, p. 63), although repeated exposure to the environment lessens this difficulty (i.e., the student can eventually 'get used to' the user interface).

Finally, some (McBreen, 2001) propose that programming is best learned via a practical apprenticeship, which Jakovljevic (2003) describes as 'based on three phases: observation, scaffolding and increasingly independent practice' (p. 309). Thus, programming is looked upon as a task to be performed more so than as a field to be learned.

However, caution is required so that we do not fall into a belief that programming can be taught in a strict behavioral fashion; there is definitely a cognitive content to computer programming which must be nurtured in order to develop real mastery. For example, Mayer (1985) demonstrates that having an appropriate mental model of the computer enables students to transfer what they have learned to new programming situations.

Ko, A. and Myers, B. (2005). A framework and methodology for studying the causes of software errors in programming systems. Journal of Visual Languages & Computing, 16 pps. 41-84

Fay, A. and Mayer, R. (1988) Learning LOGO: A cognitive analysis. Teaching and Learning Computer Programming: Multiple Research Perspectives, R. E. Meyer (ed), Lawrence Erlbaum Associates, Hillsdale, NJ.

Shaffer, S. (1996). [off-site] Resurrecting the<br />
			linguistic relativity hypothesisResurrecting the linguistic relativity hypothesis Unpublished paper.

Shaffer, S. (1997) Try cross-cultural training. Information Week, September 29, 1997.

McBreen, P. (2001). Software Craftsmanship: The new imperative. Addison-Wesley Professional, New York, USA.

Jakovljevic, M. (2003). Concept mapping and appropriate instructional strategies in promoting programming skills of holistic learners. Proceedings of the SAICSIT, Gauteng, South Africa, pps 308-315.

Summary & Conclusions


Exactly how students learn to program is not well understood, and thus designing training in programming is driven at the moment primarily by tradition. This question is strongly related to the psychology of programming; as the latter field deepens, perhaps the pedagogical questions will be answered as well.


Steven C. Shaffer works as a computer science lecturer and instructor at The Pennsylvania State University.