That's a pretty in-depth subject - wish I had time at the moment to do it justice. :-)
How do you learn a new programming language?
I actually have a mental block in learning natural languages other than English. My wife, OTOH, has at one time or another delved in French, Spanish, German, and Latin. Her opinion is that if you learn Latin, it makes learning a whole group of languages easier. I don't know that there's a programming language that fits the description of Latin (I'd hate to think that we should all be studying Algol or Fortran).
Anyhow, the first secret to learning a new programming language is to have sufficient reason to believe that you can learn a new programming language. Any learning process requires you either be naive enuf to think you can do it, or be smart enough to know you can do it. A mental block is a self-fulfilling prophecy.
The second secret to learning a new language is to have motivation. Different people are motivated by different things. I motivate myself through a number of different techniques - such as the simple goal of a specific toy example to be conquered. Be it shapes or 99 bottles. Gives me an easily obtainable goal that provides a simple motivation to learn various things about the language.
A third secret is to try to be somewhat methodical when you approach a language. Find out what are the best books for both learning and reference on the target language. Find out what information is available on the internet (the internet has made learning languages a whole lot easier IMHO). Also, if there's a newsgroup, do some casual reading and find out about the culture behind the language.
A fourth secret is to get the compiler (or interpreter) and install it on your machine. I suppose some people can learn a language by simply reading the manual. But the rest of us require actual experiments before anything registers in the brain. On some languages, getting the compiler up and running is perhaps the biggest feat (I know I've been working on and off again with the TOM compiler to try and get it running with Linux, without any luck). Anyhow, you need some positive feedback such as being able to print out "hello world". Also, take notes while you're doing the simple exercises. Try to develop your own cheat sheets that you can come back to on down the road.
Another secret, if you have time, is to either write a compiler for the language or a translator. I've written a couple of translators and it forces you to try and map languages one to other. You find out real quick about the incompatibilities and the similarities between the languages. Takes a lot of time though.
All that said, the best way of learning a language is perhaps be forced to use the language in order to make a paycheck. Nothing like hunger to focus one's mind. Kind of like being thrown in a foreign country - you soon learn how to ask for simple things like "bring me a beer" or "where's the bano". :-)
How many languages do you know well enough to read, but not to code anything complicated? Actually, I think programming languages work in the opposite direction. I can write in many more languages than I can read. At any time when writing a program, you are using a subset of the language. When you read a program, you are forced into the subset being used by other programmers. I can, for example, get by writing Perl programs, but danged if I can grok what all those other Perl programmers are doing. (P.S.: This is not necessarily a knock on Perl - my knowledge of the language is just not deep enuf).
Do you like to read code, like others read literature? Most code on the open market is not worth reading unless you need to extract very specific knowledge. But there are some algorithms that it's actually enjoyable to see how simple things can be expressed - I'm thinking along the lines of Haskell. But like most other programmers on the market, I enjoy creating my own problems rather than inheriting someone elses.
Speaking of which, another way to learn a language is to observe someone who already has mastered the language. Nothing like watching and discussing with a guru to help you focus on what works and what doesn't. The XP people are trying to capture this method with their pair programming.
...
Oh well, good thing I didn't have time, I suppose - or this would have been a whole lot longer. :-)
|