Learning New Programming Languages
TweetThis 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:
- Newbie – You lack breadth and depth. You don’t really know how to accomplish anything. You are married to the intro book.
- “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.
- 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.
twitter
September 17th, 2008 at 2:26 pm
I particularly liked the definition of an expert. I would add, as Niels Bohr had it, “An expert is someone who has made all possible mistakes in a very narrow field.”
May 6th, 2009 at 4:13 am
language learn says:language learn…
One most informative article i have read in a while….
July 20th, 2009 at 7:21 am
lbrandy.com » Blog Archive » On the Skillfulness of Developers (part 2/2) says:[...] First, and foremost, is practicing correctly. That doesn’t mean writing code often. It means writing hard code often. In much the same way I never really became comfortable with algebra until calculus, nor comfortable with calculus until electromagnetics, equally, you will never become comfortable with hard computer science constructs until you use them frequently. Linked lists cause students problems until they’ve written them half a dozen times. By writing hard code, you internalize the concepts. You’ll be ready to move on to increasingly more complicated mental abstractions. This type of practice builds up your mind’s endurance for dealing with complex mental models. And the good news is that it never ends. There are always extremely difficult concepts just out reach begging to be learned. Another excellent way to increase your programming aptitude is to learn new languages. It increases your versatility, as well, but for different reasons. As always, there is a right and a wrong way to do this. The wrong way to do it is to spend a week learning each on the most popular languages, and then slapping them onto your resume. Honestly, no one is going to believe you are an expert on C/C++, Ada, Java, Smalltalk, Lisp, Scheme, Haskell, Erlang, and Forth — even if you are. But if you did deeply knew all of those languages, your perspective on certain problems will drip with your experience.My advice goes one important step beyond learning the “correct” languages. There are many people who have made arguments about which languages you should learn to “expand your mind”. So I’ll spare you, save this: C and Lisp. Everyone should learn C and Lisp. The interesting part for me is how you know you’ve actually learned a language. Learning a new language doesn’t mean learning how to convert your C code into Python code. Hey look! You know Python! No, you don’t. I’ll tell you the secret: learning a new language is about learning how to think like programmers of that language. Its about working with and understanding the philosophy of the language. Here is my rule: you’ve truly learned a language when it changes the way you write code in other languages. [...]