I wrote this essay for one of Coursera courses I took recently and decided that I’d share it with a world.
The first language I wrote the program in was Basic. The most challenging step for me was to understand assignment statement which looked like this: x=x+1. I consider myself a mathematician who switched to programming, so for me understanding that statement was a real breakthrough: after I realized that 1) left ‘x’ and right ‘x’ are really different x’s and 2) this is not an equation but a command — after that everything was quite easy.
Learning second language (Pascal) was also pretty straight-forward: learn how to specify your commands for Pascal compiler (instead of Basic Interpreter), master couple of new principles (pointers, records etc.) and you are a Pascal programmer (well, almost). After that I learned PHP, JavaScript, and a little Ruby; now I’m mastering Python: the more languages you know, the easier adding new programming language to your skill set is.
I think that learning programming for me was quite easy because I had strong mathematical background. I knew logics, I knew how to prove things, I knew basic Boolean algebra and worked with numeral systems other than decimal. So the only thing I needed to understand really was that x=x+1 assignment: it broke my mathematical way of thinking and turned me into a (novice) programmer.
I have little experience teaching other people (of different ages) programming and what I find the most problematic for a lot of students is that in order to learn programming they have to learn two things simultaneously: 1) first they have to learn how to compose an algorithm 2) after that they immediately have to transfer their algorithm to a programming language.
Learning algorithms is quite challenging itself; mastering your first programming language when you have no experience in algorithms makes it extremely difficult.
And I don’t mean complex algorithms like sorting, binary search or graph theory. Even composing first algorithms for a basic executor like robot (whose set of commands is really narrow and includes only three of them: STEP/ROTATE/WALL?) is complex for people who have never done anything like that before. They are confused because they have very little experience controlling some executor by writing prior set of instructions that has to be clear, finite, produce a result – and a correct one – and solve not only one problem but a class of similar problems. Most students have experience in computer games where they control executors – but they do it in a real-time, and that’s a different story.
So, people are already confused. You don’t want to confuse them even more by explaining syntax: telling them about indentation, semicolons, memory and such. But you have to in most courses: you have to teach them programming, not algorithms.
The main difficulty in teaching programming (and learning it!) comes from the fact that in most cases you are teaching two things at a time: how to solve a problem algorithmically and how to write that solution in a language which is brand new for the students.
This problem goes away when students have already learned any programming language in the past and want to master second (or even second+) language: you just have to learn new syntax, couple of new principles and several abstraction models which are specific to a new language.
Writing first ‘hello world’ program is intriguing and solves a lot of problems (both for teacher and for student) – running this program means software is installed, environment is configured, IDE is working etc. – but it can be also quite confusing for a student who has no experience in so called ‘informatics’ – i.e. art of composing an algorithm.