Why should we learn more than one programming language?

Have you ever noticed how many discussions are there online about what programming language or framework is the best? People are always at forums praising one particular language and making fun of those that use something different from their preferred language. I am guilty of doing that in some point in my career. Ruby was everything and anything other than ruby was just not as good.

Time has passed and I came to the realisation that the programming language is nothing but a tool, and the real value of the software engineer is in his problem solving, which makes the programming language used by the engineer a tool to solve problems. And different tools solve different problems, and some solve the same problems in different ways.

With this in mind I would like to draw a parallel between programming and music.

Versatility in music

I have been involved with music for the past 13 years. 8 years playing with friends and in my bedroom, and 5 years playing guitar at church.

I have not done it professionally, but in my involvement with music I noticed one thing very important among musicians. It is very difficult to find a musician that does one specific thing. They usually play more than one instrument or they play only one instrument but are proficient, or familiar, with different music styles. Exceptional musicians know how to play many instruments and many different styles.

I can play the electric guitar and sing and, even though I am a mediocre musician, these two skills complemented each other very well when playing guitar in a band with many singers. I was able to guide them through vocal parts, when they should be in relation to the instrumental part, and sometimes even recommend changes in the vocal lines that would fit well with the guitar.

But enough about me, let’s talk about a real musician and his versatility.

John 5

John 5 is an American musician best known for playing guitar for Marylin Manson and Rob Zombie.

If you know Marylin Manson and Rob Zombie you would know that John 5 plays some very heavy stuff. What many don’t know is that John was a session musician, which demands for great skills and versatility, and that he is well versed in the country genre. He also plays the banjo and mandolin.

This versatility allows him to adapt banjo techniques to his guitar playing, as you can see in the video below:

This versatility allows him to write music that can appeal to many people.

He can write a very heavy song like “Welcome to violence” that will appeal to the metalheads:

But the most interesting thing that he can do is write a song that will combine all those elements and create something unique, like in “Black Grass Plague”:

You can see in the music above that he starts with a very heavy riff, and we think we know this song will be a heavy song the whole way through but at the 0:48 mark the riff resolves to a a blugrass/country section, and at 1:20 mark he goes to a heavy metal shred section. This change in the mood of the song repeats throughout the song, until the last part where he brings in a mandolin, and finishes up with the banjo.

This is a very good example on how he brings different elements, of different genres, in on a heavy song and is able to make the listener experience a variety of different feelings without coming out of this more heavy style (which I assume is one of his favourites).

At this point you are asking yourself: “And what does this have to do with programming?”. Glad you asked.

Where do I want to get with all this music mumbo jumbo?

I believe that a programmer should never be married to one language. I am all for having a preferred language, however we should always be willing to learn from other languages, even if you are not going to use it as much as your preferred language.

My preferred language is Ruby. I love how simple it is, and how happy it makes me while I am working with it (Thanks Matz), but I know I won’t learn everything I can learn from Ruby.

Learning functional programming principles is a goal I’ve set for myself this year. I know Ruby is not the best tool for the job, I will turn to Elixir for this task.

If you would like to dive into statistics and data analysis you would be better to learn some R rather than trying to do it with Ruby.

Want to become a pro in memory management, go all the way back to C and stay with it until you know what you are doing with memory allocation and deallocation.

You don’t need to leave Ruby, or make any of these other programming languages your main tool, but once you have experienced what these programming languages do best and how they do it you would have the knowledge in your arsenal for when it’s needed. You would have the option to pull from this arsenal of techniques you learn from different languages and apply it to Ruby (or any other language that is your preferred) when a problem that calls for it appear.

To sum the whole thing up

Aim to be like a session musician that is versatile and know various styles. You will be able to solve different problems using the best tool for the job, and maybe even be a professional in high demand.