The post written by my fellow programmer Kostas, reminded me of how many times I am troubled by the following thought: Is it better to stick to one or two programming languages or try to learn as many different languages and frameworks as possible?
I don’t believe in either/or mentality. I believe we should always find what works for us by trying different things and experimenting. I did that a lot of times in my career. Having said that, here are some thoughts about this question.
Spending years only on one technology can harm you in some ways. Everything looks like a nail to you if your only tool is a hammer. You try to solve every problem with the tool you know how to use better. This is great if the problems you are trying to solve are the kind of problems your tool solves better. However, what about other problems, where your tool is not so great at solving?
Some times, knowing more than a couple of programming languages, comes handy when there is a crisis in the job market. There was one friend of mine who didn’t want to learn anything else except the language he used for over a decade. One day, he lost his job. Unfortunately, only then did he realize that the language he knew inside out was no longer in demand. He struggled a lot and had to change from being a programmer to being a member of IT in some company that used that language and needed maintenance work. This teaches me, that some times, when you have your job and feel “secure”, you are also unaware of what is going on in the technology world. Especially if you are not willing to learn different things. This has the danger of learning about it when it is too late.
Even if you never lose your job, or never change the language you are using, it is still better to learn other languages because you can expand your thinking and deepen your understanding of programming.
Let me give you an example from my experience: Many years ago I was using Pascal. At that time Pascal wasn’t object oriented. I was always on the look for new paradigms, and suddenly the world started talking about OOP. Every magazine was talking about it (we didn’t have Internet back then).
I wanted to start using a language that supported OOP, but I couldn’t because none could ran on my computer. I couldn’t wait to buy a new computer, so I started using the paradigm even though my language of choice didn’t supported it. Pascal supported records, pointers and procedures/functions. If you try to see what a class really is, you will realize how I simulated classes in a non OO language.
Having mentioned “paradigm”, I would like to say that it is better to learn different languages of different paradigms, than languages of the same paradigm. Languages of the same paradigm just change in syntax, but only if you learn about different paradigms you can really expand your mind. Examples of different paradigms are: procedural programming, object oriented programming and functional programming.
Some complain of not having enough time. When I was very little, I once complained about that to my father. He told me to sit down and explained to me his theory for time management and planning. I try never to complain again about not having enough time, but lets pretend you don’t have enough time:
You can focus on your “day language” (the one you use every day at work), but at least study one new language as a side project. When I say study, I suggest that even if you don’t build something useful, at least read the theory and try to do a couple of tutorials. Even at this rate it is still better than only sticking to your “day language”.
I don’t want to forget mentioning that of course the fundamentals are very important, but how can you really learn the fundamentals if that knowledge doesn’t come from applying the languages? I assume you have already read more than 10 theoretical books on programming fundamentals, but that is just the theory. You should also apply that through the use of many languages. Not only one language.
To answer the original question: I always like to have a main language and a side language. Nowadays my main language is C# and my side language is Ruby. Respectively, my main framework is .NET and my side framework is Rails. If I see that I am mastering Ruby, I will find time for another paradigm. Maybe Ruby can become my main language, in order to make time for the new one 😉
Finally, I want to answer the concerns my friend expressed about what is better to write in his resume. If I had to decide hiring one programmer among two equally good programmers and the only difference was their language focus, I would choose the one who knows more languages because I believe he would have a deeper understanding of programming.