Sometimes I discuss with some friends that the skill set of a programmer usually is very high. People often have to learn new languages, tools and frameworks when they start a new project or just change to a new team.
I have some colleagues that get very afflicted with the fact that they will have to work with a technology they don't know well. They say the feel unsafe and may not know all the details of the new tool. One of the main points I have learnt after some years of software development is that you don't need to know 100% of all the languages and frameworks! In small projects, you might use one specific technology just once or twice in your life, and you may not enjoy that technology too much to learn all the details about it. So in this cases you would just need to know the necessary to do your job.
No, I am not saying that you don't need to know any technology in depth. I think you should know a lot about 2 or 3 languages, and the basics about the others, specially if you work into a dynamic environment. When you have to learn new stuff to do punctual jobs, go with your mind opened to 'learn the basics first', and not to 'learn 100%' of that technology. You do not need to be an expert in everything! Also, usually when you already know well 2 or 3 languages, it gets easier to learn the basics of a new one.
One thing that people used to ask me was: "Is there a way to learn a new language quickly?". In my opinion, there is no magical formula, but I usually follow some simple steps to learn the basics of any language:
Basically the first thing I do is installing the minimal environment to work with the language. For example, for Ruby on Mac I would download the installer and use it on terminal trough IRB. This is the simplest way to use the language.
Following the sequence, the next steps are doing some basics of procedural programming - creating and printing variables, creating and calling basic functions. You will see that these steps are important because you will get familiar with the language structure.
Assuming that the language you are learning follows Object Oriented (OO) principles, you cal apply the following steps next:
As you can see, the following step is applying some OO basics - create a class, add attributes, methods and create an object.
This will give you a wide idea about the language. However, we can improve this method with TDD - writing tests before can help us to learn and memorize the new language faster. So we would have the following:
Basically you can write a test before applying OO techniques. You write a test, see it red, write minimal procedural programming to see it green and the refactor with OO basics to have a nice code.
(Note: I use Test Driven Development principle of Write a test --> See it red --> Do the minimal to see it green -> Refactor. More information about TDD here and here ).
At this point, if you think it's necessary, grad an IDE for development. Further steps - relationships between classes and objects, inheritance and polymorphism, and other OO principles.
Well, I usually follow these steps and they work well for me! Sure, if I were using some functional programming language, then the step of OO would not work. I am assuming here that you are using OO.
Some extra tips for learning are making analogies between the language you already know and the language you are learning. Also, pair programming works pretty well - take a simple problem, like Fizz buzz, and implement it in pair programming with someone that has experience on the language you are trying to learn.
If you really enjoy the new language, you can consider learning more deep stuff about it. if you did not like the new language that much, at least you will be able to do your work.
This is it! If you need some extra alternative ways to learn a new programming language, consider taking a look here, here, here and here.
Yesterday, Luan blogged about learning new things - you can find lots of useful links with technical stuff about programming languages on his post.
Hope you have enjoyed!