A few days ago, I had a high school sophomore (who is now in her third CS class, having passed the prior two) look at this Java code for a solid 3-5 minutes, and was unable to figure out what it did:

int answer = -1;
while (answer < 1 || answer > 5) {
    System.out.println("Please enter a number from 1 to 5.");
    answer = myScanner.nextInt();

She couldn't identify the ending condition of the loop, and didn't understand why answer was initially set to a number outside of the 1-5 range. The understandings that she would need to comprehend this code was covered in a prior class by a different teacher, and it was covered a second time from first principles in mine.

I don't particularly need help with this student. I will tutor her and give her extra worksheets. She will almost certainly skirt by and do okay, but if the past is a good indicator, she might never be able to quite put it all together, and larger projects will be impossible for her without some outside help (which I will make sure that she receives).

However, every year, I find a small number of students who just don't seem to get it. They muddle through, but the CS major program becomes harder and harder for them as their four years go by. Must it be this way?

Is there any evidence or reason to believe that there are students who genuinely can't learn to program? Or, flipping the question around, is there any evidence or reason to believe that every student really can learn to program?

  • 22
    $\begingroup$ A noteworthy perspective is Joel Spolsky's opinion on pointers and "getting it": I’ve come to realize that understanding pointers in C is not a skill, it’s an aptitude. $\endgroup$ Commented Oct 30, 2017 at 21:43
  • 8
    $\begingroup$ I will have to dig up the answer, but a question like this was asked previously. The comments and answers pointed towards a study where one professor created a "test" to determine whether you will ever "get it" or not. He showed evidence that it was a good test. Many years later, he came back and said "I'm sorry. I claimed the test worked. It, in fact, did not." $\endgroup$
    – Cort Ammon
    Commented Oct 30, 2017 at 23:23
  • 21
    $\begingroup$ @CortAmmon Perhaps you are referring to the infamous The Camel has Two Humps, and its partial retraction? $\endgroup$
    – Ben I.
    Commented Oct 30, 2017 at 23:26
  • 15
    $\begingroup$ @Lynn I agree that the code could be clearer, but it's still not deeply complex. After how many course hours of study in Java would it still be reasonable for someone to be unable to follow this snippet code, imperfect though it may be? 20? 100? 500? 10,000? $\endgroup$
    – Ben I.
    Commented Oct 31, 2017 at 17:34
  • 11
    $\begingroup$ Is there some meaningful percentage of teachers who can’t teach students to program? $\endgroup$
    – MPW
    Commented Nov 5, 2017 at 13:51

22 Answers 22


There are a number of reasons why students don't learn, but few non medical ones why they can't. Leaving aside the medical reasons, such as hormonal imbalance or other disorders, I think that students who don't learn either have little desire to learn or have had poor teaching in the past. Even students with some learning disorders can learn given desire and patient teaching, but it can take a lot of work and understanding of the student to enable it. Once common problem with students is extreme introversion. That can make it difficult for the student to seek help and ask questions. It is good if you can find ways to help students deal with that in a positive way. See this question for more on the idea here.


Some students don't learn what you are teaching because they have little desire to learn it and no incentive to put in the work required. They may be in your course for the wrong reasons and would rather be anywhere else if it were only possible. They put in the time, but nothing else. There is probably not a lot you can do for them as that desire needs to be internal. Some students develop desire after a period of indifference, but I don't think this is common. I've had undergraduates in CS who were only in the major because their family (father) would only support them if they stayed. Such students can be counseled to study something more interesting to them if possible, even if it requires doing that in addition to computing. Better, though, if you can counsel the parents to better support their child.

Some classes are required, of course, and so interest for some will be higher and for some it will be lower. If you know something of the goals of the student you might be able to connect the current class to those goals, increasing interest and desire.

Poor Teaching

Many students do poorly in CS (as in mathematics) due to poor or indifferent teaching; especially the attitude among some teachers that it is OK to leave some students behind. Not every student takes the same amount of effort to teach and every student learns differently. My usual mantra in this situation is that "Your students are not like you." They learn differently than you did. Your presence in the classroom as a teach is proof enough that you are a special case.

Some especially bright kids do poorly in school because they are simply bored and nothing is exciting enough to them to put in the effort. Some students find other subjects especially easy and don't really know what it is like to have to work to learn. Some students don't learn because no one ever taught them how to learn. Some think that hearing something once means they have learned it and are surprised later when they can't recall something, wondering why you never taught it to them. Some students have a fundamental misconception about some small thing that has snowballed into a big block. Some students have never had a positive learning experience (maybe generally and maybe just in some topic) and simply hate everything about the process. Some teacher say incredibly stupid things to students and even some institutions have incredibly stupid ways to deal with students, actively damaging them.

I have examples in my learning and teaching background of each of these things.

As a student I was a thought not very bright when I was a kid and was nearly "held back" to repeat an early grade. However, I was just deadly bored with school. No one ever bothered to tell me why I was there or why or how I should try to succeed. Being bored I was a bit of a troublemaker, leading to lack of support from teachers. Later on, I was given an IQ test and the results were reported back to me as "You probably have the skill to succeed in a Junior College, but probably would only be frustrated by a full undergraduate program." I later earned a PhD, of course, so the assessment was a bit "off". The first course in which I actually learned anything was in Plane Geometry in HS. I got entranced by the problems there. Prior to that, mathematics was, perhaps, my worst subject. The doctorate is in Mathematics, of course.

In teaching, I once had a student with two problems. First he was dying of a chronic condition, but also he had been given misinformation about the precedence of operators by some early teacher that was reinforced when he used a too-simple pocket calculator. He couldn't seem to get it right in elementary programming and learned to hate it. He thought he was stupid that he didn't get it and he thought that all of his teachers also thought he was stupid. I think I managed to convince him otherwise before he died but we banged heads a bit before the reason for his difficulties became clear to me. It took a bit longer to convince him that I wasn't actively trying to deceive him.

I once had a class of students who were almost all doing very poorly. Since my teaching style then was to face them, rather than lecture with my back to them, the diagnosis was pretty simple. No one had ever taught them how to learn in a classroom. They sat passively and listened and watched, taking no action themselves. I asked one why he didn't take notes and he pointed to his head and said "It's all here." Well, I had evidence otherwise, so had to interrupt the syllabus to actually teach them how to learn and to force them to actually do it. I've discussed part of the method in another answer on this site.


If you want to teach every student, however, you need to know every student. If someone is doing poorly, you need to try to understand why that is and to tailor a solution to their needs. To do that you need to be dealing with a reasonable number of students, of course, so if you are a professor of 800 students, the individual care must be given by your army of helpers. But even wit 20 or so students you need help. This is why pairing and group work is so important and why you can't always let students choose their own groups. You need to get feedback from the members of the groups (peer evaluation) and you need to find ways to act on what you learn.

The solution to teaching every student is not to individually tutor every student, but to find ways that every student can learn what they need to learn on their own terms. Not every student wants to earn first marks. They want to learn "just enough." They are satisficing rather than optimizing. You can make that work for them too, so that "not earning first marks" doesn't mean "failing."

Success Story

I once had two students (compiler course) who were repeating the course after failing it. The classmates of these two were generally among the best I've ever had in one group. But these two had, seemingly, never had a positive experience in CS. They seemed to be dull, requiring repeated explanations of the simplest ideas over and over. Fortunately the course was taught in an incremental way in which the students could accumulate points toward success rather than by demonstrating it on exams: a project course. I convinced them to come to my office hours and there was never a time thereafter that they weren't there. Fortunately the other students didn't require such high maintenance. I also had simple ways for students to ask questions when they were working on their own and so these two could get small helps whenever they needed it. It turned out that these two wound up (a) explaining things correctly to me by the end of the course (b) earning the highest grades that term, and (c) angering the other students who thought I'd put these two in the class to make themselves look bad. My last contact with them was to remind them of what they had done and that they could repeat that elsewhere if they were willing to put in the same amount of work. I think that teamwork also helped here and they supported one another throughout. Note that I didn't need to put additional time into the course for this to happen. The office hours were required and the mailing list for questions was a common feature of all my courses. Another question here seeks ways to make this out-of-class communication easy, though I think it needs better answers at this time.

  • 35
    $\begingroup$ This is also lacking any kind of evidence. You may think “that students who don't learn either have little desire to learn or have had poor teaching in the past,” but can you actually back that statement up with some kind of evidence? I have read evidence contrary to that statement, and while it was far from ironclad proof of any kind, I think this question desperately needs more than generalities and possibly-wishful thinking. $\endgroup$
    – KRyan
    Commented Oct 31, 2017 at 3:52
  • 5
    $\begingroup$ (Doing some due diligence here.) It seems that the paper I had read suggesting that they had evidence demonstrating that not everyone can learn to program has been retracted for overstating its conclusions. However, you can read the retraction here—it still isn’t supremely encouraging. It shows that a lot of the data that went into the retracted paper is real, and if the suggested explanations for them lack sufficient evidence, we’re still left with problems we don’t know the causes to. $\endgroup$
    – KRyan
    Commented Oct 31, 2017 at 4:02
  • 4
    $\begingroup$ In short, once again, I strongly recommend finding actual research and evidence for your claims that the answer to the title question is “no.” You kind of just assert that and then go into all your hypotheses for reasons why students fail despite the lack of a population destined to fail. $\endgroup$
    – KRyan
    Commented Oct 31, 2017 at 4:03
  • 27
    $\begingroup$ Actually, having taught for about 45 years, my sample is >10K. Every student is an anecdote, of course, but there are a lot of them. Since I also taught at quite a variety of places, I'd guess I've seen most of the range of possibles. $\endgroup$
    – Buffy
    Commented Oct 31, 2017 at 10:36
  • 4
    $\begingroup$ This post seems to be 80% about bad teachers. However programming is a constant, never-ending learning process. If you want to be successful, you must be able to study and learn new things by yourself without the assistance of a teacher. Having a good one can help, but a good programmer ought to have enough learning aptitude to learn to program from scratch, if need be. $\endgroup$ Commented Nov 5, 2017 at 10:19

Maybe. It's hard to prove a negative.

How does knowing that help educators in any way?

If that knowledge helps somehow, how does that compare to all the ways that belief can be harmful?

  • Giving up on students who "just won't get it"
  • Not reflecting on how teaching can improve, since the ones who failed "just won't get it"
  • Noticing "patterns" in the students who "just don't get it"

There have been students who privately I had serious doubts about. Repeated explanations went nowhere. Trace after trace was slow and labored. Then... later... eventually... they figured it out. Next year they passed the class.
Later, they got a job as a programmer.

I realized that I just can't know. Students come back and get it together. If I had shared my judgments it would have completely derailed their success. I can only help each student the best I can. And that includes believing that each and every student is capable of learning programming.

  • 10
    $\begingroup$ This is a surprisingly practical answer. $\endgroup$
    – Ben I.
    Commented Oct 31, 2017 at 3:01
  • 2
    $\begingroup$ This answer says that no matter how many wrong predictions (patterns or others) you try, you can't predict an observable quantity X. Like ever. So basically it says science can't work. $\endgroup$
    – kubanczyk
    Commented Oct 31, 2017 at 19:16
  • 20
    $\begingroup$ @kubanczyk -- come on, don't be factious, the answer isn't saying "science doesn't work" or anything silly like that. Rather, this answer is saying that regardless of what the predicted value is, the best thing for the educator to do is to help all students to the best of their ability. So, since the predicted outcome doesn't (or at least shouldn't) influence how you teach, and since prediction is difficult, why expend effort worrying about it? $\endgroup$ Commented Oct 31, 2017 at 20:02
  • 9
    $\begingroup$ I think you're being a little too naive here. If person A requires 10x as much work to "get" a topic X as person B in school, then there's a nontrivial chance that that's going to be just as true on the job as it was during school. Meaning that hiring them for that job might be bad both for them and for the employer. You don't expect see this when they're hired because they could (and should) have already spent the 10x time necessary to become as good as everyone else who is applying. But their recognizing this can be useful knowledge for them: they can try doing something they are better at. $\endgroup$
    – user541686
    Commented Nov 1, 2017 at 18:13
  • 2
    $\begingroup$ @Mehrad I think you're assuming each person has an intrinsic learning rate for programming topics. I don't think learning science supports that. $\endgroup$
    – nova
    Commented Nov 1, 2017 at 20:34

As I indicated in the question, it has been my experience that there are certain kids who never seem to come along. My data is drawn from a rather small group (definitely under 1000 kids learning CS over the course of my career), and @Buffy's idea that these students are satisfying rather than optimizing may well be correct. However, I haven't seen convincing evidence of that. What evidence I do have, unscientific though it may be, is that there are, indeed, students whose brains are simply not wired for this field.

It always appears to be the case that, with enormous effort, they can obtain some very basic competencies, but the material does not fit "naturally" into their way of thinking, in much the same way as not everyone can feel certain aspects of musicality. (See beat deafness and the 4% of humanity with congenital amusia.)

It is important to note that I am not suggesting that people with such musical disabilities can learn nothing of music; rather, I am suggesting that a very high level of musicality (such as that associated with the professional musician) may never be realistically attainable. It is also worth noting that 4% is not a terribly low number; over the course of a teaching career, one would encounter many students with such handicaps to overcome.

Programming requires substantial sequencing ability, a certain intuitive capability to informally understand (and guarantee) post-conditions, and the ability to simultaneously understand multiple layers of abstraction.

Within the normal distributions of abilities, therefore, it stands to reason that there will be a (not insubstantial) subset of people who will have enormous difficulties with the topic. And, similar to music, it may not be that they are incapable of learning any particular aspect of programming, but they may never really be able to pull it all together with any sort of facility, no matter how hard they work.

  • 3
    $\begingroup$ I'll admit that some have "enormous difficulties". But that isn't the same thing as "can't learn". Ask Stephen Hawking about difficulties. I'll also admit I have no ability in music. But I have no desire, either. $\endgroup$
    – Buffy
    Commented Oct 30, 2017 at 20:46
  • 10
    $\begingroup$ My experience as a dev (mainly teaching interns/juniors, but also as a quest teacher at our local uni) is that you hit the nail right on the head. The comparison with musical ability is spot on in my view. I tend to give these students the same tough love my guitar teacher gave me: If you like it, by all means continue, but I would look elsewhere for a career if I where you. Maybe they will learn 'eventually' and with 'enormous difficulties' but the student you described in your question will never get hired here, as we value 'learning speed' over actual knowledge. $\endgroup$
    – Douwe
    Commented Oct 31, 2017 at 15:26
  • 9
    $\begingroup$ +1 for "wiring". I don't have so many data points (only ~20), but I once taught "Intro to Programming for non-CS Majors", easily the most challenging course I ever taught – not because the material was hard, but because so many students found it hard to grasp basic concepts. There were three groups in the class: the "naturals," who programmed with ease from Day 1; the "lost," who struggled with Hello, World and struggled even more mightily as the course progressed; and the "learners," who struggled at first but eventually turned a corner. (Only one of my students that term was a learner.) $\endgroup$
    – J.R.
    Commented Oct 31, 2017 at 20:42
  • $\begingroup$ I can speak to the combination of desire to learn and inability to do so. I cannot hold a tune. In fact, at most, I can only tell that one note is higher or lower than another, no more than that. Yet I still played Clarinet for years. My only reference for whether the note was actually in tune is if someone else told me, I simply had no ability to tell myself. I tried so hard to learn, but I am seemingly fundamentally incapable of hearing if a note is in or out of tune and what the note is or isn't. $\endgroup$
    – SGR
    Commented Nov 3, 2017 at 11:39
  • 4
    $\begingroup$ I had all the mechanics of playing an instrument down, I just had no way of knowing if what I was playing was actually in the correct pitch. In a similar fashion, I can see a student who understands all the parts to a program but can't make sense of the program as a whole in their mind. $\endgroup$
    – SGR
    Commented Nov 3, 2017 at 11:39

However, every year, I find a small number of students who just don't seem to get it. They get through, but the CS major program becomes harder and harder for them as their four years go by. Must it be this way?

Think of it this way:

An alien lands on Earth. He sees a human, who encounters another human. The first human flips the second one off. In response, the second one flips the first one off.
The alien goes on to meet world leaders, scientists, philosophers, ... Every time he meets someone, he flips them off. After flipping them off, the alien's behavior is perfect, he makes no other mistakes. No one corrects the alien, because they understand that he's culturally unaware of its meaning and they understand that the alien is trying to say hello. Since the alien is capable of being friendly, no one is really incentivized to address that one mistake that the alien makes. It seems like nitpicking.

After the alien has met with diplomats (and diplomatically minded people), he eventually ends up in situations where there is less goodwill towards the alien's cultural obliviousness. The alien starts noticing that people are reacting less friendly towards him, even though he's still trying to use human greetings.
As time goes on, the alien struggles more and more to keep interactions with humans on a friendly level. After several years, he finally fails and ends up in a fight with an angry human.

The inept student, just like the alien, was initially in a position where little to no mistakes could be made (first year only uses simple examples, the alien only meets diplomatically minded people). The flaws of the student/alien are not big enough to fail a test/conversation.
But as the student/alien progresses through the ranks, it gets harder (harder examples, less diplomatic people). Eventually, there comes abreaking point where the mistakes of the student/alien are important enough that they do prevent a good outcome, and this is where the student/alien fails for the first time, even though they were making the same mistake all along.

As a student, it's a curse to only be somewhat inept. If you're completely inept, then teachers will focus on you and will make sure that you do it right. But if you're stuck in the "not good but good enough" zone, then you may never receive that attention from your teacher (because they're focusing on students with bigger problems), and you'll never be told that what you're doing is wrong.

When no one tells you that what you are doing is wrong, then you can't know that what you're doing is wrong (or could be improved).

Is there any evidence or reason to believe that there are students who genuinely can't learn to program?

Yes and no.

Everyone is capable of learning programming, but different people will have different levels of intuition and will learn things at a different pace.


In college, I studied Digital Arts and Entertainment. This course was unique in the world (at the time), because it was both a full-fledged course for artistic design (concept art, freehand drawing, 3D modeling) but also technical game development (programming, ranging into complex geometrical mathematics).

There were two very clear groups in our class: the artists and the analysts (I was in the latter group). The artists passed the art classes without breaking a sweat, but needed to learn programming step by step and never seemed to really intuitively understand something (e.g. int division) without having it intricately explained time and time again.

The analysts, on the other hand, were passing the programming classes with flying colors, but often couldn't manage to design or draw anything halfway decent, especially compared to the artists. They would have to redo freehand perspective drawings many times over, whereas the artists managed to get it right the first time and then had a lot of time left to improve their already succesful drawing (thus creating even more of a gap between the art that the artists and the analysts produced).

This course irrefutably proved to me that some people are wired differently than others. It was so very obvious to see it happen for every class we took. The people who were outclassing me in art class would need my help in programming class, and vice versa.

Out of the 300 students who started the course in my year (I'm already omitting those who gave up midway. 300 students took the final exams of the first year), 8 managed to pass all classes. Almost everyone else got caught up on either the art or the programming.

This was my second time in college, and I have to admit that the % of driven students was much higher than in other courses. There were <10% slackers, most people were spending their nights designing (either games or art, whichever held their fancy).

Seeing less than 3% of students pass both art and programming classes proves the point.


But then again, 8 students managed to pass.

I personally knew 3 of them. One had not programmed before the course, the other two had never been artistically inclined. So it's possible to learn a skill, even if it's almost completely orthogonal to your current skillset.

I'm also a strong believer in the fact that if someone does not understand something; that it simply hasn't been explained to them in a way that makes sense to them (or they haven't been driven enough to find out for themselves).

You need to investigate the ignorance.

For your current example, this does mean that we should investigate what exactly she wasn't understanding.

She couldn't identify the ending condition of the loop

There's a "spectrum" of ignorance here. It's important to figure out which one applies to this student:

  • Was she aware of what a while is used for in general? (regardless of why it was being used in this particular example)
  • Was she aware that it is an ending condition? (regardless of what the specific condition itself was)
  • Was she aware that this was a boolean evaluation? (regardless of what was being evaluated)
  • Could she explain the evaluations (evaluating if a number is bigger than another number) but not the combined intention of both evaluations (evaluating that the number was between a lower and upper bound)

Based on which of these describes her situation (or something I didn't list), you can work towards filling in the gaps in her knowledge.

To use my college example, if she has an artist's mindset, she may never be able to intuititively understand code and read it like a second language, but given enough effort, she should be able to eventually identify what happens.

Without making this a personal attack on you, I think it's important to consider that when a teacher considers a student incapable of something, that this could also mean that the teacher is incapable of teaching it.
As the teacher, you can never be sure which one it is.

This is a variation on the Dunning Kruger effect. If you apply the principles of the effect, that means that it's possible that a teacher's evaluation of a student's incapability to learn something may simply be a misinterpretation. The teacher doesn't know how to teach this student effectively, and therefore considers the student flawed, instead of their own teaching ability.

This can be subconscious and is in no way malevolent on the teacher's part.

From my experience with teaching programming (and being taught programming), the most effective way to gauge student skills and also teach them how to read code is to play the breakpoint guessing game.

In essence, put some breakpoints in the code (this can be on every line if you want), start the program, and have the students try to predict what the next breakpoint will be.
Note: this is very easily gamified. People love betting, so allowing them to bet on the outcome teaches them to figure out what the outcome is.

For a student who is vastly underskilled and not getting it (as you suspect this student is), you'd expect an inability to make any reasonable prediction, or continuously stating that the next step cannot be predicted.

Step through the whole program. Keep repeating the same code over and over again, until she makes accurate predictions (even if she's only reciting it from memory rather than understanding).

Once she is able to recite the steps, change one thing in the code (e.g. one of the numbers in the while condition). Repeat the breakpoint guessing game.

If she actively disagrees with what you say the next breakpoint will be; that's a really good thing. This means that she has an opinion about the flow of the code. Ask her to justify her claims. Do not correct her, just get her to clearly express her own thoughts. Find the error in her claims, but don't point it out.
Instead of correcting her, show what the next breakpoint is. Ask her to explain why the outcome is different from what she said. Only explain things once she gives up with explaining, or is clearly saying random things and hoping to get lucky.
As a software developer, I notice every day how often I spend talking to myself about how the code is going to flow. This is a quintessential skill for a programmer. If you're too quick to explain, you're effectively preventing her from trying to think for herself. The idea is that she shouldn't rely on what others say, but rather try to find the answer for herself.

Every person should be able to understand the logical flow of a simple code snippet, given enough repetition of the guessing game. Every human is innately able to distinguish and recognize patterns (even if they can't do it intuitively).

Everyone is capable of learning programming, but different people will have different levels of intuition and will learn things at a different pace.

The only people who actually cannot be taught something, are the people who do not want to be taught something (or do not want to put effort in learning). As long as she wants to understand it, she eventually will.

  • 2
    $\begingroup$ I really like this answer, thank you for taking the time to write it. I hope to see you around the site more! $\endgroup$
    – thesecretmaster
    Commented Nov 6, 2017 at 1:52
  • $\begingroup$ @thesecretmaster: You're welcome :) $\endgroup$
    – Flater
    Commented Nov 6, 2017 at 8:46
  • 1
    $\begingroup$ Learning by prediction/observation gets my +1. A hugely transferrable skill $\endgroup$ Commented Jan 2, 2020 at 22:50

Consider the posibility that this could be a problem with Java.

If your first language is APL, and many fail... is a reflect of the students or APL?

Read also:


Is Haskell the right language for teaching functional programming principles? No! (As Simon Thompson explains.)

I have learn dozens of languages and have teach a little. Certainly some languages are more problematic when others are not.

My pet theory? I think if we accept that most software is poorly designed including programming languages, then users are not only learning how use the program(ing language) but struggling to dechiper the (poor) design and what is the true design beneath.

  • 3
    $\begingroup$ Welcome to Computer Science Educators! I hope we hear more from you in the future. $\endgroup$
    – Ben I.
    Commented Oct 30, 2017 at 22:47
  • 6
    $\begingroup$ I agree that there are "wrong" languages for teaching programming. However, if it were possible to develop a "right" language that would permit anybody to learn to program, I'd expect the past half-century of looking for it would have produced at least some hint of success. $\endgroup$
    – Mark
    Commented Oct 31, 2017 at 21:38
  • 5
    $\begingroup$ Sure it have not existed? What about pascal or python? Is to note that the choice of "language to teach" is driven by the idea of "must be a industry standard" and in some places have been replaced older languages used for years to get trendy. So I'm unsure if this is proven or not. $\endgroup$
    – mamcx
    Commented Nov 1, 2017 at 2:31
  • 3
    $\begingroup$ If the code snippet was using some obscure part of Java, then that could definitely be true. However this is simple enough that anyone who understands a while statement should be able to answer it. And inability to understand "keep running this code while the condition here is true" means they truly haven't grasped how code works. $\endgroup$
    – Graham
    Commented Nov 1, 2017 at 12:01
  • 5
    $\begingroup$ @mamcx, Yes, Pascal was created as a teaching language. So was Python. So was Basic. So was Logo. AppleScript had "anyone can program" as a goal. Wikipedia lists almost a hundred other languages for teaching people to program. And yet, somehow, people still have difficulty. Maybe it's not the language that's the problem? $\endgroup$
    – Mark
    Commented Nov 1, 2017 at 21:12

I firmly believe that, barring actual mental handicap, anyone can learn to program.

However, this is purely a belief; a matter taken on faith. It is informed in part by some knowledge of psychology and the process of learning, but in these things I am at best an amateur.

The available evidence, unfortunately, does not demonstrate that anyone can learn to program. Even though the infamous “The Camel Has Two Humps” paper has been retracted, the retraction itself isn’t massively encouraging: the underlying data, according to the retraction, is all still valid and real. The conclusions drawn from that data was too strong, and in particular the actual “Camel” web article that got passed around so much made far stronger statements than even that—but nonetheless, the data is still there. It suggests a problem, and the retraction only says that we don’t know what causes it—not that it doesn’t exist.

Furthermore, the paper cites numerous others in its claims of widespread low academic achievement in computer science: it does not stand alone in that claim.

Thus, my conclusion is basically this: it may be, and I dearly hope it to be, that all students can learn to program. However, the available evidence suggests that, if nothing else, we have not yet learned how to teach all students to learn to program. Whether that is because it can be done and we just haven’t figured it out yet, or because it truly cannot be done, seems to remain an open question.

So I would recommend all computer science educators to try to keep an eye on the state of the art here, and be willing to try new things. The status quo does not appear to be sufficient. It certainly isn’t settled science that there is a population who cannot learn programming, so even though that may be true, it is too early to give up on those who are failing right now.

  • 1
    $\begingroup$ You may be an amateur in this realm, but that it a perfectly sound analysis. Welcome to Computer Science Educators! $\endgroup$
    – Ben I.
    Commented Oct 31, 2017 at 10:03
  • 1
    $\begingroup$ +1. Very sad to see the only answer that tries to bring actual data to CS Educators so low. I wouldn't have thought this to be such a faith based community. Shameful :( $\endgroup$
    – Shane
    Commented Nov 7, 2017 at 5:39
  • 1
    $\begingroup$ In this paper "Evidence That Computer Science Grades Are Not Bimodal", Patistas et al. seem to prove that the grades are indeed not bimodal... $\endgroup$ Commented May 10, 2018 at 18:55
  • $\begingroup$ @NunoGilFonseca Excellent, glad to hear it. I am not a CS educator, so I have not taken as much time as I might recommend following this topic, but that is a promising sign. I hope there are more studies and more papers that confirm that result. $\endgroup$
    – KRyan
    Commented May 10, 2018 at 19:04
  • 1
    $\begingroup$ The problem with "barring actual mental handicap" is that it makes the argument effectively circular: "Except for those people who cannot learn to program, everyone can learn to program." $\endgroup$ Commented Dec 27, 2019 at 17:25

This is all from my own personal experience, no research: I believe all students can learn to program, and can "get it", barring some mental handicap. But they have to have the desire, as many have stated - that's the kicker. And you, the educator, must have the patience to stick with them until they "get it".

I have been a computer science educator for six years at the high school level. Prior to that I was in software development. I tell my students they are all climbing a mountain. I tell them some will reach the top and see into the promised land well before the others. But, I tell them, if they will work hard, and not give up, they will all eventually reach the peak of that mountain and see over.

And I see that happen. Some of them reach the peak in Programming I (at my school that is Visual Basic). Some of them are still struggling toward the peak in Programming II (C#). And some of them give up before they reach the peak. They drop the course or don't take Programming II at all. But those who stay the course, pun intended, almost always develop a deep understanding and love for coding, and I see them in Programming III (AP Java), which is my goal.

For what it's worth, here are some "tactics" that may be useful to others:
1) Allow students to turn work in "late". Yes, those programs were due yesterday, but you kept working and have them ready today? Good for you, for persevering! Of course I'll take them.

2) Conversely, allow students who are always finished quickly to move ahead in the course or give them "challenge" exercises to complete. Or send them to a web site like HackerRank where they can practice their code and compete with others.

3) Also allow students who are finished quickly to move around the room and help others, if they desire. But don't force them. And pay attention that they're not just "dictating code" to others. Instruct them that they must explain or give direction only. Some students are really good at this and enjoy it. (FYI my school is on the block schedule with 90 minute classes. We are in a lab and when I am not instructing my students are writing code.)

4) Preach Carol Dweck's growth mindset. Effort == success.

5) Seat students so that those who are struggling are next to someone who has only slightly better understanding than they do. They will naturally work together because they are both lost a lot, and the one who understands a little bit more will spend a lot of time explaining to the other, thereby gaining confidence. The one who has slightly less understanding will also gain confidence because they will realize they are not the only one who doesn't get it instantly.

6) Make them write code on paper, both for practice and for tests. So many students become dependent on their "smart" IDE and don't know their syntax!

7) As a corollary to the previous, emphasize the necessity of memorizing syntax. Whether you understand it or not, you can memorize the syntax of a for loop to iterate through an array.

8) Remind them that they didn't learn something they are good at overnight, nor did they do it perfectly the first time. Programming takes practice, just like anything else. And sometimes they may have to move ahead without fully understanding what they just did. As they use it more, one day it will come to them.

9) This is similar to someone else's idea about "predicting" in the debugger: make your students "read" their code to you. I make mine, periodically and individually, tell me, line by line, what a piece of code THAT THEY WROTE is doing. If they can't, I tell them to go home and study it and try again tomorrow.

10) Structure programming assignments with "levels" of scaffolding. In your Word document, or web page, or however you give the assignment, give a high-level overview of what the program is supposed to do first. Students who have understanding will take it and run with it. Then, after the high-level description, for students who need more, provide a more detailed description with pseudo-code or code snippets. This will allow more students to be able to do the program and to feel successful.

11) Celebrate small victories. When a student finally gets something, even something simple, get excited. Encourage them not to give up, and when they don't, when they persevere, and they have a breakthrough, no matter how small, praise them!

12) Sometimes you have to have a frank but gentle conversation with a student - if you hate this, and don't want to put in the time necessary to really GET the topic, then why are you here? I would wager that the girl who didn't understand the while loop after several semesters of instruction was spending little time outside of class studying about what a while loop was, when and why you use it, and practicing coding with it. She was depending on an instructor to "teach it" to her, to feed her like a baby bird. She didn't want it badly enough.

OK, I've said enough, I know a lot of this is anecdotal, but I hope some of it is helpful to someone.

  • 3
    $\begingroup$ Welcome to CSEducators. You show a sophisticated view of teaching that I hope you will bring back here often. $\endgroup$
    – Buffy
    Commented Feb 25, 2018 at 23:29
  • 1
    $\begingroup$ Agreed. Welcome to our community! $\endgroup$
    – Ben I.
    Commented Feb 25, 2018 at 23:53
  • 1
    $\begingroup$ Thank you, Buffy and Ben, I am excited to be here! I hope to learn a lot! $\endgroup$
    – Java Jive
    Commented Feb 26, 2018 at 0:04
  • 1
    $\begingroup$ Now this is the kind of answers we need on this site. And six years of teaching might not qualify as "research" in you lexicon, but most research is based on experiential data, whether it's acknowledged or not. Along with Buffy and Ben, I'm glad to see another thoughtful voice in on our site. Welcome $\endgroup$ Commented Feb 26, 2018 at 2:11

Always try to explain it some other way.

Try it in another language - there are reasons why BASIC and Visual Basic are used as 'beginner languages', although I would look for 'teaching languages' that entrain a better understanding and good coding habits.

I would no more teach someone to program in Java than I would teach them to fly in an F-104.

However, this isn't about syntax and choice of programming language.

There may be some flaw in your logic, or a gap that you're skating over without even realising that there's an unaddressed assumption or assumed knowledge.

There may be some error in your student's understanding - some unstated assumption or 'gap' that she's filled-in incorrectly and internalised - and she might not be aware of it. If that unstated error leads to a dead-end, that's it: game over. The exercise has failed.

It would be entirely unsurprising that she isn't able to elucidate and express the 'blocking' point: you are working to develop this ability formal logic in your student and you are both well aware that it is developing from a very low base.

The question is: can you reframe the exercise in a way that might reroute you both around a problem that neither of you can identify?

That's enough on teaching technique from me. I coach something else entirely unrelated to coding - although I do coach and mentor my fellow-programmers - and you need to discuss this with your professional colleagues in teaching.

Now to address the more general question: are there students who simply cannot be taught to program?

I'm assuming we're discounting students who have a generally-poor intellectual ability, and that this is about intelligent and able people who have some specific cognitive impairment.

Dyslexic people may have difficulty and it isn't just 'they can't read'. They can interpret symbolic information, but layout and formatting are far more important than you realise.

There are people who simply cannot dial a telephone number or retype an eight-character code unless it is broken up into smaller groups - and you will empathise with them if I tell you to type in "1101110111111111101110111111101" on your keypad right now.

What if your code sample is wriggling in front of them, like ones that binary, and they cannot pin down extract the logic from this unusable and illegible text? It doesn't matter that it's perfectly legible and comprehensible to you, or even to ninety-five percent of your students.

Dyslexic people are very good at concealing their impairment, and at working around or under or over it. Often, so good at both these skills that they work out how to read all by themselves, despite the ineffective assistance of their teachers, and are never even aware that they have dyslexia unless they are tested by professionals.

And now they've met source code, which is another reading skill: text that conveys formal logic, and has none of the structure of spoken language. Or at least, not the structures that they have learned in their internalised implementation of reading.

Try the same problem in Python. And discover that there are coders who are fluent in slicing and never, ever, code a loop - not even in those rare cases where it really is the best way to proceed: I wonder why that is?

Be warned, dyslexic people are also very, very good indeed at spatial visualisation and logical abstraction: the mistakes they make as beginners, including the attempts they make to 'bridge' over gaps like unstated assumptions and assumed knowledge, can be incredibly convoluted. This will be especially true of the mistakes or 'blocks' that they cannot elucidate and explain to you!

It is in the nature of dyslexic peoples' unconscious (but highly-developed )strategies for reading (and, say, successfully associating names with faces) that they apply extremely complex abstractions to everyday problems without even knowing.

This isn't about dyslexic students: I'm using them as one example among many, of students who can program - and program very well indeed - but can be surprisingly difficult to teach.

There is, of course, dyscalculalia: a fundamental inability to perform arithmetic. Or so I'm told: I'm still sceptical, and I would classify these rare students as "people that a long line of increasingly-specialised teaching professionals are unable to teach arithmetic".

If it's real, it probably does have an analogy in a fundamental inability to program.

I am reminded that Bertrand Russell's wife, who spoke seven European and oriental languages fluently, and who was regarded by her husband, among others, as his intellectual equal, never understood the operation of canal locks: despite all attempts at explanation, with working models, by the most eminent engineers philosophers and professors of the British Empire.

So yes, you are probably right that some people will never program; and I am completely in agreement with JWZ's assertion that the extended abstraction required to 'get' pointers, rather than merely use them in a pro-forma way, is absent from all but a tiny minority of the human beings alive today.

A final point, and a deeply unpleasant one: you may have inherited the results of bad teaching in the student's past.

Be warned, some people who are labelled 'introverted' have been very, very badly taught and it is a common malpractice in bad teaching for girls to be conditioned, by a sustained campaign of extremely negative feedback, to step back and step out of a challenging problem that they are not 'expected' to be able to solve. They will have internalised this, and they will have been very thoroughly socialised in the skill of diverting themselves - and you - around that. And they will absolutely steer you around the dangerous confrontations inherent in considering the problem to be anything other than their problem, and their fault.

This is less common with boys but it exists: and the higher education institution that you work in is, perhaps, more of a place for people who have been encouraged or permitted to excel than the place where all excellent students can enter and reach their potential.

You may be very fortunate, with this particular student, to have been given an opportunity to undo that; and, whether this is the case or not, I am very pleased to hear that you have both the will and the resources to find out what she can really do.

  • 1
    $\begingroup$ I think F-104 and Java is a bad comparison... the F-104 set lots of world records for speed and altitude and had a poor safety record... that sounds much more like C. $\endgroup$
    – user541686
    Commented Nov 1, 2017 at 18:40
  • $\begingroup$ "I am reminded that Bertrand Russell's wife". I was curious about this anecdote, which I'd never heard of before. I think it mght be Russell's grandmother, not his wife. I got an hit on Russell's autobiography, which says "She never could understand how locks on rivers worked, although I heard any number of people try to explain it to her". It's possible one of Russell's wives has a similar problem, but it seems more likely you've read a scrambled version of this anecdote, or remembered it incorrectly. $\endgroup$ Commented Nov 4, 2017 at 11:11
  • $\begingroup$ From context, his grandmother would have been born Lady Frances Anna-Maria Elliot-Murray-Kynynmound, the second wife of Sir John Russell, once British Prime Minister. They lived in Pembroke Lodge. $\endgroup$ Commented Nov 4, 2017 at 11:18
  • $\begingroup$ Locks: walk to where there is a small stream with a little pond in it. Block the upper end, observe, unblock. Block the lower end, observe, unblock. Done. Teaching is about pointing the nose in the right direction and getting out of the way. Sometimes it just takes a bit more time and effort to get to the right place. $\endgroup$
    – Scott Rowe
    Commented Feb 3 at 13:43

Nature vs Nurture

It seems that nature plays a large role: you can not teach a cat to code (even though they share approximately 90% of our DNA. However most of the variance between humans is probably nurture.

See Carol Dwecks word on growth mindset, for who some learn and some don't. Note that we can have a growth mind set in some subjects, but a fixed mind set in others, “I can't do maths.”, “I can't program.”.

Everyone (that can learn anything) should be able to learn to code at the level of you example. However not everyone will be excellent at it. I have taught a lot of pupils in year7 (UK), they can do this in scratch. Many of them that had good teachers in primary school, can do it when they arrive (see choice of language below).

Therefore help students to get a growth mindset.

Syntax vs Concept

Is the student struggling with reading the language, or with the underlying concepts? If the student does not know the idea of a loop, or the higher level idea of loop until successful. Then understanding the code will be very hard, it may even rely on discovering the idea.

Therefore ensure that students understand the concepts, before teaching a language. This can be done using «robot teacher/student», or other paper/acting/physical based activities.

Procedural vs Functional vs …

Are you teaching in the best language? What influenced your choice of language? Is it the best teaching language? vs Is it popular in industry?

Bertrand Myers has claimed in (I think) “A touch of class”. That it is easier and quicker to teach Eiffel then C# and Java and …, than to teach any one of these from the start. Yes he teaches his CS student all of these languages, but starts with Eiffel, as it is easier to learn (yet also more powerful that the others, and the only pure OO language that I have seen. It is also one of the languages where all the new ideas are coming from (see also lisp) ).

In a camel has two humps (an argument for natural ability, I won't go into why this research is not valid here, but there is one thing of relevance), it looks at mutating-assignment, and shows that student that don't get mutating-assignment struggle to program.

Therefore teach mutating-assignment last. E.g. functional, but you can do functional in any language.

Is this semi-functional program easier to read?

do {
    System.out.println("Please enter a number from 1 to 5.");
} while ( myScanner.currentInt() < 1 ||  myScanner.currentInt() > 5 )

This code snippet uses «Command query separation», that is every method is ether:

  • a command that does something but does not return anything (a procedure), or
  • a query that returns something but has no side affects (a function).
  • $\begingroup$ Affects? Effects? $\endgroup$
    – kubanczyk
    Commented Nov 7, 2017 at 9:45
  • $\begingroup$ When I first learned Lisp in college I could see why it worked and was so powerful (you can do essentially everything it is possible to do, you'll just have to build the universe yourself), but I thought it would be easier to tackle something more "domain specific" and less free-form, initially. There's a reason Fortran was so successful: it was designed to implement formulas, which is what the users normally did all day. Few people spend their days making new universes. When I learned C in college, I thought, ok, now I can finally learn: how can such a thing as a computer possibly work? $\endgroup$
    – Scott Rowe
    Commented Feb 3 at 13:51

(Sorry, too much for a comment) I've had a related experience back in college that I think is relevant. I was a lab assistant, the lab was sometimes used for a computer literacy for seniors class. I could see one fundamental sticking point for nearly a third of the attendees: They couldn't comprehend changing the meaning of a key. The machines were TRS-80s--they don't have a control key. The word processor needed one, thus IIRC the @ key was hijacked for the purpose.

Students either got it or they didn't, the ones that didn't never got it and struggled greatly even with the aspects of the class that didn't involve that. The ones that got it fared much better.

If they didn't understand the remapped key by the end of the second class period neither the teacher nor I had a single success.

I have seen various students that seemed about as clueless when it came to understanding code but I've never been in a position to help them over an extended period of time to see deeper into what's wrong and whether it could be overcome.

  • $\begingroup$ It is an insight, a clue. Remapping has to do with treating things symbolically, not in a fixed way. If you see a world of as-if where everything just happens to be a certain way but could easily be different, then it will be easier to think and manipulate programs and data that way. As a snarky, jaded kid who thought everything was arbitrary, wrongly set up, unfair and inflexible, I saw copious opportunities to remap basically everything. Why is Joe so great? If he was 3 inches shorter, then everyone would like Tom better! See? It's one small step to manipulating joe and tom as variables. $\endgroup$
    – Scott Rowe
    Commented Feb 3 at 13:23

Some personal experience. I have a PhD in computer science and have had a very successful 40-year career in software development. But often, when presented with a new concept, I have had great difficulty "getting it". I think the problem happens when you build an incorrect mental model of what is going on.

I think the first time this happened was on first introduction to algebra: with x=3 and y=4, I was convinced xy had to be 34. There's nothing stupid or ignorant about this, and it doesn't mean the pupil will never overcome it: there's just a misunderstanding that has crept in somewhere, and I think it can be very hard for a teacher to discover where that misunderstanding lies, and correct it, because the teacher simply doesn't realise where the faulty step in the reasoning occurs.

Later, when introduced to programming, I remember I found it really hard to understand function calls. I don't know now what the problem was, just that I had great trouble with it. (I also found it hard to grasp that xy was no longer 34, or even 12, it was now completely unrelated to the values of x and y.)

In recent years I've taught a good number of XSLT courses. One of the areas where I find students really struggling is with recursion. The main frustration in teaching this is that you don't know why students are finding it difficult. Sure, it's a very abstract concept but it becomes so second nature that you no longer see the difficulties, and that makes it hard to help the students overcome them.

  • $\begingroup$ Yeah, recursion is not an everyday thing in most people's lives. You've learned the forest and can walk around blindfolded but students keep smacking in to trees they can't recognize. What's different about programming? Symbolic manipulation. It's not the everyday way of approaching a problem, and some problems cannot be solved without it. Teach that. Math was the 'way' in the past but we need to move on. $\endgroup$
    – Scott Rowe
    Commented Feb 3 at 13:35

Probably almost everyone can learn to play basketball, but if you intend to go up against professionals at some point, the taller you are, the better, because they are going to be tall. If you are not going to be a professional, then no problem, just have fun.

This points out the essential question: Why are we educating people?

  • So that they can get good jobs. Parents push their kids toward or away from things for this reason. (Mine pushed me away from programming, but I resisted and became a programmer and now teach programming.) It is certainly important for everyone to be able to make a decent living, so this horn of the dilemma cannot be refuted.
  • To make well-rounded people. We all need to have some understanding of a very large and rapidly growing number of topics to function well in this world. So this horn cannot be refuted either.

It would be great if students knew early on what they were interested in (as I did) and had the drive to overcome obstacles to get there (as I did), but apparently, mystifyingly, many kids and young adults simply have no idea what they want to do for a living. I don't know where the failure lies for that, but it is the cause of the seeming dilemma that we face. More drive on the part of a student will push them to either eventually succeed, or fail fast. But, like the famous basketball coach said, "You can't teach height", and we can't impart drive.

I agree with everyone who said that it is not a teacher's job to decide what is best for a student - whether they belong in the program or not. Do your best as a teacher and stop worrying about whether it can be done or not. This is the conclusion I came to after 4 years of teaching.

  • $\begingroup$ But, but... Formal Operations too. $\endgroup$
    – Scott Rowe
    Commented Feb 3 at 13:31

Well I'm not a teacher myself but I can tell about what happens in our programming classes. My class has 32 people in it and we all have to learn coding in C#, a language that basically everyone of us hates. Last year we had the best teacher in the school but he had to go away and we've got one of the worst one. The class is divided into 2 groups with each having 16 people in it. Well truth be told none of us actually wanted to be a professional code but he have to learn it as it's part of the curriculum. So from all 2 groups there are only 4-5 people who is actually interested in it for many reasons. (one wants to make games, other android apps, and the others, including me, as a hobby). Well from what I see in my group (and hear in the other) most kids are not interested in learning coding. Even though they'll need it in their finals they just don't care. When I look around at class I always see around 5-6 people using their phones or sleeping in classes. Well probably because the teacher is not good now all they know is last years things (partially, very partially) and when ti comes to writing anything complex: they just look at each other. And when you ask them why don't you learn if you are concerned about your grades? They would say "because I won't ever use it after school".

Well it's true that my class doesn't really have anything to do with coding, but the system we're in makes us learn them. I sometimes speak with other teachers who teach the kids who are in the ACTUAL class that learn coding and will work as software developers and he says that they aren't interested either. So in my school the kids, who will work as devs, are not interested in it? (that's a 32 people class too) of course there are always a few who wants to learn but in general here it's quite low.

So from what I'd seen and heard you need:

  1. first and foremost: they just look at it as an other subject to learn and have grades from. They are simply not interested in it even if that's what they'll be working as. They need will to learn it.
  2. Then there is of course the power of a good teacher. My current teacher came into this school 4 years ago and well knows nothing and is really boring. Many times we have to correct his code. The teacher should try to make the classes interesting for everyone also maybe she needs some special methods. Like as OP said some extra sheets to test on and experience.
  3. Maybe she doesn't have time to learn or thinks it's not as important as other subjects because it takes more work and time to learn and understand. (for example here we (those who know some more) usually correct other people in the class and explain why that code was wrong.)

And to end this I want to say the same as what that other teachers told me about it: They just don't care about it, they are not interested in it anymore. It's plain boring for them to look at a black console with white letters.

  • $\begingroup$ They used to force everyone through all these math classes, now it is programming. What is the objective? Formal Operational thought. You must get that if you are going to have more complex work. Get it somehow: be a team captain, join the Army, just get it. Programming is easier to fit in to the classroom, and more fun than math. Math never made a web page. $\endgroup$
    – Scott Rowe
    Commented Feb 3 at 13:28

I think the answer is "yes".

It seems obvious that there is a segment of the population with severe intellectual disabilities, severe learning disabilities, brain damage, cognitive inability to read or do problem-solving, etc., who will be unable to do programming. The real, difficult, question is: What percentage of the population is that? (Or perhaps, as educational leaders with limited time and resources: For what sort of students is it profitable for us to invest resources into their programming education?)

As partial evidence, it seems clear that on the continuum of subject matter, computer science is intellectually demanding in a special way. Benneden/Caspersen start their 2007 article with the following:

It is generally accepted that it is very difficult to learn to programming. For example Bergin and Reilly note that It is well known in the Computer Science Education (CSE) community that students have difficulty with programming courses and this can result in high drop-out and failure rates. (p. 293).

Current data show that computer science has the highest dropout rate of any college major. E.g.: 10% of UK CS student drop out in the first year, with next-highest major at about 7%. (see HESA data, 2017-2018, Table NC1). Similar discussions are seen in Ireland and Trinity College, etc. Borzovs et. al. in Latvia 2015 share their motivation for a study this way:

In recent years the observed practically stable trend to lose from one-third to half of students in the first year of computing studies motivated us to explore, whether the world has not found indeed a method, how to determine in advance such applicants that have no chance to overcome the first study year. On the one hand, the dropout students and the teaching staff have wasted their resources...

Benneden/Caspersen show an overall worldwide dropout rate of about 33% from the programs that responded to their survey (about 12%). Interestingly, it's almost impossible to find hard data from U.S. 2-year programs, but I think the following estimate is accurate:

A colleague from the ACM Education Council mentioned an internal report of community colleges (two-year schools) in the US who were in a coalition to improve their retention rates in CS. One school reported an average failure rate, over a ten year period, of 90%!

Related, on SE Mathematics Educators, we have the question: What fraction of the population is incapable of learning algebra? Ben Crowell, looking at demographic and standardized-test scores, has an answer where he estimates around 50%. Separately, I found an overview of research into Piaget's theory of learning stages (Mary Carol Day, "Thinking at Piaget's Stage of Formal Operations", Educational Leadership, October 1981), which found that among those tested, only a similar 50% could ever perform at the terminal "formal operational stage", which would seem highly related to performance in math and computing:

Piaget's position has often been used to predict that one who can think in a formal operational manner will always do so. However, only about 50 percent of those over 12 years of age who are presented with tests of formal operations perform in what would be considered a formal operational manner. This is true of college-educated adults as well as adolescents. In addition, even people who use formal operational skills on one task may not use them on another.

Anecdotally, when I started teaching CS courses at a community college about 20 years ago, my starting assumption was a passionately-held "no, of course anyone can learn programming!". That particular ship broke and sank on the first day, when I sat with a student after class for an extra 3 hours trying to get him to understand the first lab, until he said, "I just can't get this", and walked off. Now I'm going to believe what that student told me, as I've seen it many, many times in this context. In fact, in some cases I think it's cruel and dispiriting and immoral to continue encouraging some people to pursue CS programs, e.g., after they've failed to pass CS1 for several semesters in a row. My instinct would be to politely challenge those who think otherwise to try and teach CS at a U.S. open-admissions community college for a semester.

I will hold forth that there's a fairly large segment of the population that can never understand the concept of a variable no matter how much or long or how many strategies they use to try. This is similar to the observation by Joel Spolsky, one of the founders of the Stack Exchange network, who wrote:

I’ve come to realize that understanding pointers in C is not a skill, it’s an aptitude... For some reason most people seem to be born without the part of the brain that understands pointers.

  • 1
    $\begingroup$ Sorry, but "can't learn" and "difficult to learn" are completely different. $\endgroup$
    – Buffy
    Commented Dec 23, 2019 at 12:13
  • $\begingroup$ @Buffy: Re: "can't" vs. "difficult" -- they're not the same, but one is evidence for the other. Especially in the overall context of the rest of my answer. $\endgroup$ Commented Dec 23, 2019 at 18:29
  • $\begingroup$ Actually no. People drop out for a lot of reasons. They fail to learn for a lot of reasons. One is poor teaching. Another is no real desire to learn. Sometimes when a field is advertised in the popular press as having good employment prospects (CS often) people flock to it with no idea about what it is and then drop out when they learn it is hard work. But, desire is the key, not any innate ability or lack of it. $\endgroup$
    – Buffy
    Commented Dec 23, 2019 at 19:46
  • $\begingroup$ Hmmm. You down vote my answer for lack of evidence, I see. But I happen to know (and have worked with) some of the people you mention here and they don't come to the same conclusion you do, so your "evidence" is misleading.. $\endgroup$
    – Buffy
    Commented Dec 23, 2019 at 19:51
  • $\begingroup$ @Buffy: I would be skeptical of that. If you could link to the counter-conclusions by some of those people I think that would be very valuable for all of us. $\endgroup$ Commented Dec 23, 2019 at 22:44

I'd like to preface this by stating that I am not an educator, and thus have had no formal training, however I have had experience while working on my undergraduate in computer science helping people to code. Then after I graduated I helped my wife through an informatics degree in which she had to take programming classes, and I found the following article to be very insightful, and actually described the problems my wife was having quite clearly.


Now her goal was to just pass the class, as she had no intentions of moving on to any sort of a programming degree, and I'm sure that contributed somewhat to her continued difficulty with the course, but should never fully got over the first hurdle illustrated by the article (a hurdle, that I submit your student is probably having difficulty with at this time).

The authors of the paper posit that the primary hurdles in computer science are..

  1. assignment and sequence
  2. recursion / iteration
  3. concurrency*

The article (and linked paper ( link here ) indicate that some people have extreme difficulty figuring out operator assignment, and they can't tell you the value of variables a and b after the follow chuck of pseudo code (even after explaining the basics of pseudo code).

 int a = 10
 int b = 20
 a = b

The test was administered twice; once at the beginning, before any instruction at all, and again after three weeks of class. The striking thing is that there was virtually no movement at all between the groups from the first to second test. Either you had a consistent model in your mind immediately upon first exposure to assignment, the first hurdle in programming – or else you never developed one!

I hate to use a single study / article to say there are people who can't learn to code, rather I like the idea that, armed with this knowledge, educators can better understand where to focus, and maybe develop better techniques to overcome these specific hurdles.

  • 6
    $\begingroup$ Welcome to Computer Science Educators! It might be worth noting that the study he is citing was partially retracted, as I described in my answer here. $\endgroup$
    – Ben I.
    Commented Oct 30, 2017 at 22:47
  • 4
    $\begingroup$ I really wish Jeff Atwood would post an update / disclaimer on that blog post $\endgroup$
    – nova
    Commented Oct 31, 2017 at 2:47
  • 2
    $\begingroup$ I read that code fragment and saw instantly that the value of (a = b) could only be "false". Wrong! the author was writing in one language, I was reading in another. I think an immense number of these difficulties are actually caused by misunderstanding the notation. $\endgroup$ Commented Nov 2, 2017 at 0:38
  • $\begingroup$ The paper sourced in this answer and on CodingHorror blog was retracted by its author. $\endgroup$
    – kubanczyk
    Commented Nov 7, 2017 at 9:32

I was a CS student for several years and therefore a programming student for several years. In many different classes/groups that I was in there were always the ones who could program and the ones who just didn't get it. I believe that some people have a knack for some things and some people don't.

Things like music or drawing or math or programming logic/algorithms, etc. I tried to teach some people and no matter what I did they couldn't do even the most basic programs. Of course you can eventually teach people things, some one with a lot of learning and practice can get good at drawing but it's unlikely they'll do it as good as someone who already has a natural knack for it.

It is weird when you can see it all clearly in your head, the loop, the values that $i takes, the calculations, how the array is formed and the other person doesn't get it even when you write it down and show it to them. But this is normal, it's the way we are. Sure this person can make the effort, learn but they will never "get it". They'll always need extra time, resources and testing or they can study CS and focus on other things like I don't know networking, modules, database design, etc.


I'm going to be quite honest.

Why the heck do you care?

Even if there was such a thing, you could never know if that student was truly in that category of unable, or if it just hadn't clicked for them yet. You could never know if you were biased, if the student had never learned how to learn, if something else was going on you didn't know about, if a previous teacher had mistaught them, if, if, if.

Even if there was such a thing, it shouldn't impact your judgement.

If a student is struggling, there's a couple of important things:

  1. Do they understand any prerequisites necessary?
  2. Do they know how to learn?
  3. Do they remember what they've learned in the past?
  4. Do they understand what they've learned in the past?
  5. Do they know how to build up on what they've learned in the past?

By prerequisites I mean primarily math skills. There are plenty of kids in my grade who struggle with basic math facts like 5*9, or order of operations. That inability also damages coding ability. Further, a lot of the logic taught in math comes over to CS/coding. Math practice may be necessary to help give them more confidence.

A lot of students don't know how to learn. Maybe they've had it easy in school. Maybe it's been hard for them all along and they've just checked out. Maybe they've been struggling but don't really know how to do it other than cram for a test.

Teach them how to learn - taking notes, understanding conceptually, understanding practically.

A lot of students, especially in countries where there's a summer break, forget a whole lot over the summer, over the months, etc. Do they even remember what they've learned? I sure as heck couldn't tell you what we talked about a year or two ago. Do they remember what a variable is? Do they remember how loops work?

Even if they remember the concepts, it's even harder to actually understand them, and be able to apply them themselves in their own thinking. Explore what they mean beyond just definitions and coding, but what they mean intuitively.

Lastly, perhaps they know and understand concepts, but they don't know how to build on them. That requires practice and patient teaching, and then a little waiting for that aha! moment when it all clicks and settles into the framework of what they've learned. Help them make connections to other topics.

I said earlier in this, "even if there was such a thing". I don't believe there is such a thing. I don't exactly have evidence to back it up. I just have two reasons.

  1. People are amazing. I could tell anecdote after anecdote about someone who would have looked, to teachers, below average - but as a friend I could see that they were way more intelligent than the teachers thought.
  2. I can't believe that as a matter of principle. If other people might be limited at learning, I might be too. I don't want to think that. I want to believe that with enough hard work, I can learn what I wish to learn. Sure, others might, probably will be, better at it than me. But I believe I can learn it, whatever it may be.
  • $\begingroup$ You are making a huge assumption that this would be used to evaluate students instead of to self-evaluate as a teacher. I would never give up on a student, really for all of the reasons that you just outlined. But part of the emotional life of a teacher is that you really want to do a good job. It matters to you. So, when I look at my own numbers, I also need a way to contextualize them. Am I doing a reasonable job, or do I need to go back and rebuild everything from the ground up? $\endgroup$
    – Ben I.
    Commented Dec 7, 2017 at 13:13
  • $\begingroup$ I guess I didn't read it the same way @BenI. did. I think the advice is good, and yes, you can be doing a "reasonable" or even excellent job and still need to at least reevaluate everything. Hmmm, what could I have done to reach the three that failed the course??? Maybe nothing, but you need to think about it. $\endgroup$
    – Buffy
    Commented Dec 7, 2017 at 16:14
  • $\begingroup$ @BenI. I missed that interpretation ;) I guess I would say that, confronted with a student who was struggling, checking that they know how to learn, know basic math facts, etc, etc, would be an important first step to knowing whether it's your teaching or whether what they learned in the past. $\endgroup$
    – auden
    Commented Dec 8, 2017 at 13:06

Many of the existing questions are excellent, but I'll throw my two cents in:

Is there some meaningful percentage of students who can't learn to program?

What is programming?

The problem is that programming can mean many different things. I remember a discussion on this site where somebody suggested using Excel spreadsheets as an introduction to programming. I would have failed that class, and I would have realized that I just wasn't cut out for programming.

Programming with a focus on command line interfaces is a step up from Excel spreadsheets, but it's still alienating and disengaging for many students.

"But command line programming is the simplest form of programming!" Command line programming can seem straightforward to more experienced users, and we can see it as the simplest form of programming. But that's not true for people who haven't worked with a command line in their daily lives. "I use websites and apps every day, and I'd love to learn more about creating that stuff, but if programming is just staring at a command line all day then maybe this isn't for me!"

Frame Things Differently

So although this student had trouble wrapping their brain around command line programming, maybe they'd have better luck with other types of programming: maybe they'd be able to better reason about robotics, or code that outputs a physical drawing, or more creative coding? Maybe if the output was a webpage instead of in a terminal, they'd have to spend less time remembering how the terminal works.

In other words, it's not that students can't learn programming. It's that they have trouble reasoning about a particular type of programming. The answer is not that they can't program, the answer is that they need to be introduced to programming using topics that engage them.

Line by Line

Similarly, maybe the student has trouble explaining their thinking to a teacher. "Okay they asked me a question. Oh god. They want to know why the number is initialized outside the loop. How should I know, I didn't write the code! Oh no I'm not saying anything, this is awkward. Maybe if I stay silent they'll give me a hint. Wait what was I supposed to be answering again?"

The answer to this is to encourage students to break things down into smaller pieces. Don't ask the student why the variable is created outside the loop. Ask them what the first line of code does. Then ask them what the second line does. Have them work through it line-by-line, and then have them combine that into a bigger picture. This is a very hard thing to teach, and I think many students get stuck trying to understand entire pieces of code instead of just focusing on one line at a time.

"I must not be cut out for programming, because I can't look at 10 lines of code and tell you what they do." Neither can I, and I've been programming for my entire adult life. I look at one line at a time.

Gym Class

When I was in school, I hated gym class. I hated basketball, and I hated running the mile. I'm sure if you would have asked my gym teachers, they would have told you that I'm part of the certain percentage of students who simply can't learn to be physically active. That lasted pretty far into my adult life. "Maybe I'm just lazy."

But the thing is, I love hiking. I love just walking around a city. I love riding my bike, and I love running, as long as I can do it with headphones in and at my own pace. I wish I could go back in time and introduce younger me to this stuff. What would gym class have looked like if it had included these types of activities?

Sorry for going off-topic, but I think about that whenever I hear people say that "some people can't learn programming". I don't think it's that some people can't learn programming, I think it's that we often have an overly restrictive definition of what programming is, or how we frame programming.

Programming doesn't take some magic brain part that only certain people have. Whenever I hear the argument that some people can't program (especially when that argument comes from established successful folks), I cringe pretty hard. It always comes off as discouraging (especially to people from under-represented groups) and gate-keeper-y to me. We can do better.

Just like every other creative endeavor, learning how to program requires engagement, and breaking things down into smaller pieces, and tons of practice. Maybe it takes a little more of those things than other subjects (probably as a result of most students not seeing programming until high school or college), but I honestly think anybody can learn how to program. It's "just" a matter of finding out which type of programming they're interested in. But that's a whole other question.


Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.

Albert Einstein

Coding is an art. It isn't a thing for everyone, you need a vocation to be a programmer. The example that you provided, is something really basic, if she can't understand it, maybe she will never do.

There is a possibility that you aren't a good teacher, but you know, programming isn't something that you can discuss, everything has a sense, a logic, if she can't program, try to suggest her to study something different

  • 4
    $\begingroup$ I disagree with the notion that a teacher (of X) should be advising a student to not study X (arguments can be made if the student is not their student; but that is not the case here). You mention the possibility that the OP isn't a good teacher; which is exactly why he shouldn't suggest that the student quits the study, he might end up discouraging someone while the fault lies with the OP. $\endgroup$
    – Flater
    Commented Oct 31, 2017 at 14:34
  • $\begingroup$ True, that's why i used the word suggest, it's different than saying "you suck" $\endgroup$ Commented Oct 31, 2017 at 14:41
  • 4
    $\begingroup$ That's not really the point. Whether OP phrases it rudely or kindly, it still ends up discouraging the student who may simply have been subjected to a bad teacher in the past. $\endgroup$
    – Flater
    Commented Oct 31, 2017 at 15:40
  • $\begingroup$ Or maybe the student is not suited to the vocation, and he's doing the person and society a great favor. As I see it either the student with come to realise that its good advice and adjust their major before it's too late, or they will buckle down and work harder. It's quite possible that the student knows the correct answer, but is afraid that they are wrong so doesn't want to say anything. $\endgroup$
    – NRiding
    Commented Nov 1, 2017 at 17:49

Yes, absolutely. I'm not an educator myself but I've been a programmer for a long time.

Just cause you can write a few lines of code does not make you a programmer. Just like every student who learns English is not going to write a best selling novel.

Do this child a favor and steer them to a different career path. If they can't determine the function of that code snippet they how are they going to debug a truly complex problem. Do you want this person writing aircraft guidance systems, banking software, or self-driving cars?

  • 2
    $\begingroup$ Welcome to Computer Science Educators! This answer could be much better if you expand and add explanations to it. $\endgroup$
    – ItamarG3
    Commented Nov 2, 2017 at 12:42

I am fairly new to teaching and found some students to simply not understand programming. Computer programming involves problem solving and some memorization and not a lot of kids are into that. Let's face it, computer programming can be a bit tedious and frustrating for a lot of people and so its no wonder why some kids don't choose a career in it. In order to be good at programming you need to have some desire and perseverance.

I find the kids that are good at math are also good at computer science. However these kids also lack a sense of creativity whereas the other kids who don't do so well in CS are more extrovert and excel in reading/writing classes.

  • 2
    $\begingroup$ Welcome to Computer Science Educators! This answer could be much better if you expand and add explanations to it. $\endgroup$
    – ItamarG3
    Commented Nov 2, 2017 at 12:40

I am not a CS educator, I just do far too much programming in the day job.

A question if I may, what course are you teaching, Programming or Computer Science? I would be disturbed to sign up for a CS course only to have it spend significant time on programming.

From the "Computer Science" title I would expect that actually programming the things would be a very, very small part of such a course (And actually not worth many marks, so why really sweat it). There are far more important things to teach on an introductory computer science course IMO, calculus of sets, complexity, some discrete maths, introductory algorithms, maybe some computer architecture, but programming is not something that it is worth wasting much time on in a CS course.

I don't know if there is anyone who could not be taught to program, but certainly most people can be taught some formal logic and ideas about algorithms. If you can give people the tools to break big problems into manageable chunks that would be counted a win in my view, if you can give them the tools to read specifications with a sufficiently critical eye for ambiguity that would be a HUGE win even if they come out unable to write a line of Java.

  • 4
    $\begingroup$ "certainly most people can be taught some formal logic and ideas about algorithms." Not in my experience. It is not uncommon to see a student who has learned some of the basics of programming to nevertheless struggle mightily when they get to classes like Discrete Mathematics or Algorithms and Complexity. Introductory CS courses typically concentrate on programming for the same reason that introductory math classes concentrate on basic calculus. It isn't what the major is really about -- but it is an essential prerequisite. $\endgroup$ Commented Nov 2, 2017 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.