This Q&A is part of a biweekly series of posts highlighting common questions encountered by technophiles and answered by users at Stack Exchange, a free, community-powered network of 80+ Q&A sites.

System Down asks:

An old adage that many programmers stick to: "It takes a certain type of mind to learn programming, and not everyone can do it."

Now I'm sure that we all have our own trove of anecdotal evidence, but has this been studied scientifically?

Related: "How do you share your craft with non programmers?"

Answer: A Study that Says Yes (66 Votes)

Serg replies:

Yes, there's a pretty famous paper online designed to more or less determine "Who is cut out to be a programmer."

A cognitive study of early learning of programming by Prof Richard Bornat and Dr. Ray Adams stipulates:

All teachers of programming find that their results display a 'double hump'. It is as if there are two populations: those who can [program], and those who cannot [program], each with its own independent bell curve. Almost all research into programming teaching and learning have concentrated on teaching: change the language, change the application area, use an IDE and work on motivation. None of it works, and the double hump persists. We have a test which picks out the population that can program, before the course begins. We can pick apart the double hump. You probably don't believe this, but you will after you hear the talk. We don't know exactly how/why it works, but we have some good theories.

Here's a blog post by Jeff Atwood that interprets the results and puts some things into context.

Despite the enormous changes which have taken place since electronic computing was invented in the 1950s, some things remain stubbornly the same. In particular, most people can't learn to program: between 30% and 60% of every university computer science department's intake fail the first programming course. Experienced teachers are weary but never oblivious of this fact; brighteyed beginners who believe that the old ones must have been doing it wrong learn the truth from bitter experience; and so it has been for almost two generations, ever since the subject began in the 1960s.

Answer: Another Study (41 Votes)

Jeff Atwood replies:

Another study, Investigating the viability of mental models held by novice programmers:

This paper describes an investigation into the viability of mental models used by novice programmers at the end of a first year Java programming course. The qualitative findings identify the range of mental models of value and reference assignment held by the participants. The quantitative analysis reveals that approximately one third of students held non-viable mental models of value assignment and only 17% of students held a viable mental model of reference assignment. Further, in terms of a comparison between the participants' mental models and their performance in in-course assessments and final examination, it was found that students with viable mental models performed significantly better than those with non-viable models. These findings are used to propose a more "constructivist" approach to teaching programming based on the integration of "cognitive conflict" and program visualisation.

Also, see later research from the same authors of the Sheep vs. Goats study (which was never actually published, to be clear). Their last and most recent study on this topic from 2009 is Meta-analysis of the effect of consistency on success in early learning of programming (pdf).

A test was designed that apparently examined a student's knowledge of assignment and sequence before a first course in programming but in fact was designed to capture their reasoning strategies. An experiment found two distinct populations of students: one could build and consistently apply a mental model of program execution; the other appeared either unable to build a model or to apply one consistently. The first group performed very much better in their end-of-course examination than the second in terms of success or failure. The test does not very accurately predict levels of performance, but by combining the result of six replications of the experiment, five in UK and one in Australia, we show that consistency does have a strong effect on success in early learning to program—but background programming experience, on the other hand, has little or no effect.

Answer: Anyone can be a Programmer (7 Votes)

Barbour replies:

Consider how easily people grasp spreadsheets. Consider how readily Alan Kay introduces children to programming by means of experiment and exploration in a programmable environment.

People may study success in college-level courses and conclude "some people aren't fit to learn programming". However, such a conclusion severely oversteps the bounds of the observed evidence. How much failure could instead be attributed to how the programming is taught (too abstract?), or which style of programming is taught (too imperative?), or the programming environment (compilation, no immediate feedback?).

It is well understood that people grasp abstractions most readily after they've already worked with multiple concrete instances—i.e. that we cannot learn something until we almost already know it. Starting with the abstract, therefore, is an entirely foolish way to teach programming. Many people who stumble over premisconceived "mental models" would thrive if taught in a more concrete environment with real-time feedback (e.g. as in the Kahn Academy for CS) then encouraged to climb the ladder of abstraction when they are ready for it.

In some cases, it is the students that fail their classes. Intellectual laziness and willful ignorance will exist in any large group of humans. Smart folk are no exception, as anyone who has argued with a brilliant crank can attest. But, especially for programming and maths, it is often the classes that are failing the students.

Related: "How to teach programming a person who completed CS studies but for 5 years was working in other profession?"

Think you know if just anyone can become a programmer? Disagree with the opinions expressed above? Bring your expertise to the original post at Stack Exchange, a network of 80+ sites where you can trade expert knowledge on topics like web apps, cycling, scientific skepticism, and (almost) everything in between.