2010-03-31

How to learn a new programing language

When learning a new computer language I usually start by implementing some simple problems. This method helps me get comfortable with the language progressively and quickly.
This is a learn by doing method. So you'll have to get your hands dirty. It's easy to find the code for the problems in the web, but that won't make you a better programmer. You'll have to put your neurons to works and read the language documentation and make a lot of mistakes so you don't repeat them in the future.
The first of this problems is know by all computer developers (I hope).

HelloWorld - compiler/interpreter, documentation - This problem won't make you proficient in the language, but after you finish it you will have a development environment and know how to create a program, compile and execute it. Additionally you will know where to find the language documentation.

PrimeNumer - syntax, loops, maths, logic - The big objective of this problem is to make you aware of the syntax of the language. After solving this problem you will be able to read most of the code written in this language.

QuickSort - more syntax, recursion, lists/arrays - This problem introduces you to richer data types of the language and by now the syntax should be very familiar.

HuffmanTree - stream reading/writing, types/classes - You learn how to think in the language. The language paradigms should be clear now. You are ready to start to solve real-world problems.

The next step is to get connected with the language community and use what you learn in the best way you can.
Sometimes you may find out that the language you just learn is not your cup of tee. But you probably discover something in that language that you can use to improve your programming skill in your language of choice.

My learning method is more oriented to general propose languages like Java, C/C++, Haskell, Python, Ruby, etc...
But I think this method can be successfully used in languages with a more specific scope like JavaScript, Erlang, PHP, Lua, Prolog, Bash and others. Most of these languages can be as generalist as the ones in the first group.

0 comments: