Learning New Programming Languages

Over the time I have learned a lot of programming languages. DOS batch scripts was the first, but that is not really programming, more scripting. Later I started to learn C but got stuck at pointers. At that age I just did not understand this concept from the book I had. My father has showed me HTML and then PHP, I started to create my personal website with that. And then with PHP I was able to program things that other people could see and try out on my website. Then I wanted to write GUI applications and came to Java, programmed a bunch of little games with that. During my high school I also needed to learn Pascal for my computer science class but never gotten far with it.

During my work at DLR I started to learn Python and used it for data analysis. Then at university I attended a course in C given by two very funny mathematicians. This gave me a completely fresh start into C and I shortly after wandered off into the C++ world and still really like it there. I used GNU Octave (the free clone of MATLAB) for my lab courses first and then switched to Python for that task. I picked up Bash scripts somewhere along the way, did some scripting in Vim. Eventually for my master thesis I could do even more C++.

And then during the PhD I seemed to have picked up another trove of languages. My advisor has an R library to analyze the data that we see in that field. PhD students have tried to rewrite it in Python which they liked better, but it just lacked features and maturity. It turned out that learning R was really straightforward at this stage. It just took me a few weeks to get going in the language and after a few months I had the impression to really feel the language. I also picked up Haskell for fun and the Wolfram Language for a specific task.

But why am I writing all this? The interesting thing here are the decreasing costs of learning a new programming language. Just as with spoken languages, the programming languages fall into categories. The very first language you learn will be tough because you will have to learn that particular language but also programming and also patterns. The second language will be easier as you already know how programming works. But you might not have seen enough diversity to abstract the patterns that are there. So the second language will be about that language and abstracting patterns. Just as I learned a lot about German grammar while learning English and having to formalize the concept of grammar.

The third language will be much easier. One already knows that there are certain patterns and just needs to see how they are done in that particular language. You can already ask specific questions and take a look at build systems, how unit tests are performed or what object orientation mechanism is available. From there on every additional language will be just a variation on a theme.

That only works if the languages are from the same family though. For instance C, PHP, Java, Python and C++ are all procedural languages. It means that the main construct are statements that are executed in order and you the flow of control is just line-by-line with classic constructs like if or while. Also Ruby, Perl, Vimscript, Bash, R and many others fall into this category. Then there are object oriented languages like Java, Python, C++, modern PHP and Ruby. R has some object orientation tacked on, but it is not an object oriented language like Java is. There are interpreted and compiled languages, but that makes just a little difference.

Functional programming languages are a completely different beast. I learned Haskell when I was already doing my PhD and had plenty of abstract thinking acquired during my studies. The abstractions used in Haskell are different from those in C++. There are no sequence of statements, there are no loops, no real if-statements. So although I could understand the language, I still had an extremely hard time to write any code with it. If you don't have loops and all you have ever known are loops, then how do you solve problems? Turns out that functional languages use map and recursion to solve these. And I already knew a few of these concepts from Python but did not program in these exclusively. So after a bit of practice with Haskell I was able to write Python code in a functional style. I also carried this functional style into my R and C++ code, making it more understandable, to me at least.

Later on I needed to do something in the Wolfram Language and it turns out to be a very functional language. With the patterns that I picked up from Haskell it was really easy to learn the language and put it at use. Well, not as easy as Python but still I was a bit used to the functional mindset. The amount of transferable knowledge from other procedural languages was limited, yet still a bit helpful.

In conclusion I would say that learning additional programming languages becomes easier over time. So asking about the number of languages that one has experience in does not really make sense after perhaps three of them. And I can recommend to look into languages that one does not really need to use. Still one can gain some patterns and new ways of expressing something. On the other hand one should not try to become seriously proficient in too many languages at any one time. There is more than just the syntax, there also are the libraries that one uses. I have a fair knowledge of Python, R and C++ libraries. But everywhere else I basically have no idea what the hot JavaScript or Wolfram Language libraries would be. So concentrate on few languages and learn them well, you will be astonished at how much transfer you will have when switching to something else.