The original question is about what fundamentals are necessary for a person to be able to program. This question was discussed in 2006 on Coding Horror. A study was done at Middlesex University, UK, to find what were the pre-requisites, what were the fundamental mental abilities necessary, before a person could program. The three fundamental abilities they came up with were
- assignment and sequence
- recursion and iteration
- concurrency
If you couldn't do this, you couldn't program. I've seen this in classes, and in schools, and with co-workers and friends. Even just the first one is a show-stopper. Some people can do algebra, but assignment just floors them. Their mental models do not allow it, and they cannot grasp assignment. Nothing wrong with that, they make fine dentists and accountants and fit into other useful and worthy professions, but they can't program because they can't grasp the fundamentals.
At one time, I believed that everyone could program, it was just that they weren't taught right. After many, many futile attempts to teach right, I have given up. Some folks required a lot of effort and still never got it. Many adults have completely forgotten algebra and need a lot of revision to understand the concept of variables. When it comes to assignment, it becomes obvious that their algebraic abilities are so minimal that their schooling was monkey-see-monkey-do. They weren't able to consistently apply assignment. They guess, they take wild stabs, their minds are slippery little fishes that swim all over the place and they cannot consistently apply assignment. I suspect that the mental model of variables is lacking in their brains. I used to have a number of visualisation techniques for imagining variables, little holes that held objects, that sort of thing. I don't need the visualisation nowadays, but that visualisation seems to be a prerequisite to programming.
I also suspect that the people who taught memory tricks before computers became prevalent, could have been programmers. They had mental models and visualisation techniques and could consistently do assignments, even if it was shoving facts in imaginary boxes in their brains and pulling those facts back years later.
If you find someone who can handle the idea of assignment, and can apply it consistently, the next big barrier is iteration. So many people go to pieces with iteration. Again, the mental models appear to be missing, or are the wrong sort. They can visualise a static model of data storage, but allowing change to those mental models is beyond them. They cannot set up a mental framework of variables, and then be able to follow a loop and change the variables as the loop progresses.
I don't believe recursion is a barrier to the ability to program. I know many fine robust, plodding programmers who function quite adequately churning out reports and data entry screens who are completely unable to understand recursion. I don't believe that recursion is a fundamental programming skill, but I do believe that it's a big separator between the lower programmers and the higher programmers. I like having lower programmers around. They get to do the boring donkey work while I get to do the experimental and the new and lay the patterns for the lower programmers. But recursion, it also depends on a mental model understanding. The more I explore these ideas, the more I come to believe that the other answerers who said "mental models" were right. Programming is all about the ability to form mental models and be able to manipulate those models. Without that ability, you can't program.
Persistence and curiosity and logical thinking and all the other suggestions might be the separators between barely adequate programmers and great programmers, but they aren't the separators between non-programmers and programmers.