How to learn a new programming language


I used to have a problem learning new programming languages. It wasn't that I found the syntax difficult, or that concepts eluded me. Rather, it was the idea of learning an entirely new language a fairly time consuming task. It hasn't been until recently that I've come to accept that my definition of what learning a new programming language means was wrong, or at least poorly thought out.

What learning does not mean

First, let's clearly define what learning a new language really means. For a long time, I always assumed learning a new language meant understanding the ins-and-outs of the ecosystem surrounding the language. What I mean by this is best explained in an example.

If I said I knew Objective-C, I'd most likely mean I know iOS development. Of course, one can know Objective-C without knowing iOS development, so I'd make sure to write both Objective-C and iOS development down. But when I said I knew Objective-C, it meant I also understood the tooling around it. I understood how to use Xcode, I knew the ecosystem, how to write Podfiles, I understood the various blogs and communities surrounding Objective-C. I would also use Objective-C as the implication that I knew the Cocoa Touch framework (helped along by using iOS development). The idea here is that I knew much more than just Objective-C. And learning all this stuff couldn't happen in a few weeks.

How people can learn in a few weeks

So, using this as a standard, I always shook my head whenever someone would talk about picking up a new language in a few weeks.

"A good programmer can pick up a new language in a couple week," was a mantra I never quite agreed with. The problem, however, wasn't the mantra. It was that we were defining what was being discussed in different ways. A programmer can pick up a language in a short period of time. Especially in an environment where there is support for that language. Take any language you sort-of know, and put yourself in an environment where you are working alongside people you'd consider experts in the field, and you'll probably agree that you'll pick up the language fairly quickly.

At the end of those few weeks, you'll be productive. You won't be perfect, and you'll still have much to learn, but than we can use that to describe anyone, really.

What learning a new language means

When looked at through those eyes, learning a new language is really a matter of understanding how to use the language to be productive. It doesn't mean you understand every nitty gritty trick. Rather, it means you know enough to move forward. You have a foundation in that language.

If asked to write a program in that language, not only could you evaluate whether the language was suited for the program, but you would know where to start.

When looked at in that light, learning a new language becomes a much less daunting task.

How to learn a new programming language quickly

This is the part of my article where I make a bold claim. That claim is "quickly." However, the idea is sound, and not originally mine.

The quickest way to learn a new language is to implement a program you already know how to build. The classic example for the web is to build a blog. You already know how to build a blog. There is a good chance if you are a web developer, you've built one yourself at some point. So, by building a blog in your new language, you are focused on the language, not the problem.

Now, don't get stuck up on building a blog, as this is just an example. Your program for learning can be anything you want. It can be an IRC bot, a mail client, or your own personal image upload server. It can be a Twitter client as is popular with iOS tutorials, or it could be a game server for tic-tac-toe. The point isn't the program. Rather, it's that it's complex enough to incorporate multiple technologies you'd want to know.

Going back to our blog example, you could say that the blog needs a database, thus ensuring you'll need to learn how to connect to various databases. You'll need to learn how to cache those results, so you aren't connecting to the database when you don't need to. You'll need to handle data input, comments, and tempting. You'll need to understand quite a bit, but it's not difficult enough that you are caught up with what you are doing. Rather, you are focused on how to do it in the language you want.

A new year

With the new year approaching, I'm sure there will be a lot of people resolving to learn new programming languages. Instead, I'd like to challenge you to change your thinking. Don't learn a new programming language. Rather, write a program in a new programming language.