Learning New Programming Languages

Posted by Louis Brandy on 01 September 2008

This isn’t meant as a guide on how to learn languages. There is only one way: write. And then write some more. And then keep writing. You may take occasional breaks to read, but make them short. If you want to be an expert on a particular language, you’ll need to repeat that process for years.

If you are like me and you try to learn languages for the sake of learning them then this article is for you. Hopefully, you also realize that there are languages out there that have alot to teach you, too. I am going to skirt the issue of which languages can teach you which topics and save that for another day. This article is about knowing when a language has given up its secrets. On that note, there are three general stages in learning any programming language:

  1. Newbie - You lack breadth and depth. You don't really know how to accomplish anything. You are married to the intro book.
  2. "Getting it" - You understand the breadth of the language. You get its fundamental concepts and you do things the way the language intended for you to do them. You use the reference.
  3. Expert - You understand the depth of the language. You understand all of its nuances. When you encounter a problem, it's usually a bug in the compiler. You are the reference.

In truth, getting to stage #2 is sufficient for learning any language you don’t need for your job. Every language has a method to its madness, a set of constructs, and a way of thinking. Learning the secret sauce of any language gets you to stage #2 and that’s when you finally get it. Getting a language is what will change the way you think. It will make you a better programmer and give you a new set of paradigms with which to attack problems. If you use a particular language for your job, you want to be at stage #3. However, if you want to learn the language for it’s lessons or to broaden your programming horizons, stage #2 is all you need.

How do you know when you’ve finally gotten it?

This is actually a fairly interesting question. You can’t really know if you’ve fully grokked a programming language until you are well on your way to expert-hood. Unfortunately, I believe most people who do not use a language professionally will abandon it far too quickly and not really gain as much as they should from the intellectual exercise. For example, simply being able to write functioning and correct programs in your new language is insufficient. Often, you just write old-language-style code in the new language. Yea, if you were writing in Java you’d use that for-loop. But this is Python. You don’t need to do that. This is the newbie stage. Newbies transliterate code. They take the code as it is in one language, and change the semantics, the verbs, and syntax over to the new language. That’s great, but you haven’t gotten it yet. Unfortunately, this is when many people quit learning and declare that they know such and such a language.

You’ll know when you’ve gotten it when you stop transliterating code and start translating algorithms. If you are implementing the algorithm through the correct language constructs and it feels right, you’ve probably started to get the language. If you’ve converted that Java for-loop into a python list comprehension, you are probably on the right track. But even then, that’s not when you’ve fully figured the language out yet.

Truly understanding the magic of a language changes the way you think. Here’s my rule: you’ve truly understood a language when it changes the way you write code in other languages. Hopefully, most of you know exactly what I mean by this. For those of you that don’t, I suggest you learn a new language :). For example, learning your first functional language will shatter your programming world. Or, for example, you will never write C code the same way again once you fully think like an Ada programmer.

What language(s) should I learn?

This question seems to get asked alot. If you are asking this question because you want a job, learn Java. It’ll probably be a sucky job, but hey, that’s the answer. Hopefully, if you’ve read this far, you want to learn a language because you think it has the most to teach you. The best answer is to learn the language that’s the most foreign from what you know. Also, C. Make sure you learn C.

← Developer Timesink: Name Paralysis Weighing a 747. In an Interview. →

© louis brandy — theme: midnight by mattgraham — with help from jekyll bootstrap and github pages