Frans Ekman's blog


View Frans Ekman's profile on LinkedIn

Can anyone learn programming?

There has been a lot of discussion about whether kids should be taught programming in school, even as early as in preschool. Like always, there are different opinions on the subject. Many based on the question whether everyone can learn programming or not. Some say it is only for certain kind of people. Usually at basic programming classes in universities, it seems as if some people just “gets it” and others don’t. What could be the reason? I have my own theory.

I remember reading from Malcolm Gladwell’s book, Outliers, that there had been a study showing that the success of a math student is directly proportional to how much time the student is willing to spend on a problem before giving up. I think the same applies to programming as well. Even though most programming tasks do not require any knowledge in math at all, programming and math have one thing in common; they both require the same kind of logical thinking.

A lot of people try to learn math in school by trying a little bit on one problem and then giving up and moving to the next one. Almost as if they would be practicing throwing darts. You throw a dart, you miss the target, you throw another one, you might get closer, a third one… and so it goes on. They think that they should know how to solve a problem immediately. If they fail by not seeing the solution immediately, they move to the next problem. They will go through all problems but fail on each one.

During my studies, I remember seeing people desperately trying to learn programming exactly this same way. They got a problem and thought that they should be able to just write the code immediately. Sometimes they were able to write something but realized that it did not compile or it did not work for some other reason. They almost immediately gave up and thought that they failed, after which they moved on to the next problem and did the same all over again. One completed task is better than having tried on 10.

I believe anyone can learn programming, if they just accept the fact that it is something that requires time. That first exercise takes as long as it takes, but once it is done you have learned a lot. Having this right attitude will make sure you will later master any more difficult language construct, library or anything else. Even though it is always frustrating at first, once you understand how something works, a lot of things start to make sense. You will see that there are patterns. Bigger pieces of information will start coming easily. In the end you may not need to spend that much time after all. You just need to accept that the initial effort required is huge and you need to be prepared to sacrifice as much time as is needed.

Now if they plan to teach programming in school, how are they going to get people to do this in the right way. I think they have failed to do that in math. There is a huge risk that this wonderful subject is going to be taught the wrong way. Imagine that there is a 2 hour class and the teacher will naturally want to stuff in lots of exercises. Students who get 10 exercises for 2 hours will not feel good about spending 3 hours on the first one. They will ask for help immediately or copy-paste from examples. That is the only way to get something done so it looks like you tried, while a few students are going to spend 20 hours during the weekend to get the initial boost and will therefore easily fly through the rest of the course.

I am going to teach my kids programming and I hope I will do it the right way!

Photo by Paul L Dineen