Be a Polyglot Learner First, Then a Polyglot Programmer

How dabbling in a new language now can lead to innovation later

Being a polyglot programmer has its benefits; most of us have read or heard about those benefits from various respectable sources. I’d like to highlight the importance of being a polyglot learner before being a polyglot programmer.

You heard me right—learn a new language, but don’t rush to use it in production. At least not right away. I have used this approach and have realized two major benefits:

  • Enhanced design skills, and
  • The ability to adapt quickly to an evolving mainstream language

Most programmers currently code in one of the mainstream languages like Java, C#, and C++. On a typical enterprise project, chances are we’re using one of these languages. It might seem like a tall order for most of us to be able to intermix other languages. However, it’s becoming more critical that we do. Let’s discuss why.

Languages Offer Design Ideas

Decades ago I programmed exclusively in C++. When I first heard about interface based inheritance, I was intrigued and confused at the same time. It was not obvious to me what this meant. I had not experienced that in C++, even though it’s quite easy to implement in the language. I realized then that knowing only one language really well is a disadvantage. While we become very adept at programming with it, we often tend to restrict ourselves to the design choices mostly promoted by the language.

I started branching out to learn other languages and eventually picked up Ruby. I was exposed to functional style, lambda expressions, and a few new patterns. At that time, I was working on a C# project at a bank, before the time of lambda expressions in C#. We had to manage the resources of an extensively used object, and it was getting harder to do that with the normal practices in C#. During a pairing session, it suddenly dawned that we could tactfully make use of anonymous delegates to apply a pattern fairly common in Ruby. We were able to quickly implement a style of code not common in C#, but for greater good. I can’t imagine being able to do that so easily had I not known about this capability in another language.

The controversial Sapir-Whorf hypothesis says (about natural languages) that the languages we know limit what we think. In my experience, that’s quite true in the case of programming languages. Learning multiple languages helps us program and design much differently, and possibly better, in the language we program each day.

Languages Stretch Our Mental Muscle and Prepare us to Adapt

The other benefit of learning a different language is it allows us to adapt quicker when the mainstream language we’re programming in evolves. All of the mainstream languages that I mentioned now have lambda expressions. Programmers who have explored other languages like Ruby, Groovy, Scala, F#, Clojure, Python (and the list goes on and on) generally are curious to know how the lambda expressions in their mainstream language compares to the feature in other languages they’ve looked at. They tend to catch on to the new features fairly quickly. While other programmers who have kept themselves restricted to the mainstream language might feel frustrated with new features and wonder why they should consider or bother with these new or different ways.

Humans are pretty smart in general, but we’re not as good at learning a lot in a short amount of time. We learn in deltas, in small chucks. If we get exposed to new ideas in bite-size proportions along the way, it is much easier for us to adapt to new ideas in a language when it evolves.

When I started writing Functional Programming in Java 8, I was quite curious how the new Java would measure up to other languages on the JVM such as Scala, Clojure, and Groovy. I wanted to implement tail call optimization in Java, based on how that’s done in those languages. I could not have done that had I not explored those other languages. There were a lot of new features in the language, but thanks to learning these other languages, it was not a new concept for me. I only had to pick up the nuances rather than confront a whole new paradigm.

The reasons for learning a new language are compelling. It’s not a matter of abandoning the current mainstream language, but rather getting better at using it and being able to adapt as the language evolves. It’s worked quite well for me; I hope it does for you also.

Related

Sign up for the O'Reilly Programming Newsletter to get weekly insight from industry insiders.
topic: Programming
  • W.

    Oh the joy of being a polyglot…
    When I left the industry in 2002, I had learned and used over 35 languages (including versions of the same language) at a time of rapid technological change, and whilst it is very stimulating and interesting when you are intensely curious as a young developer. By the time you should be in middle management, your interest in learning yet another version, or an obscure feature of a language to do differently, though perhaps more easily, what you did years ago, can pale…

    And perhaps you get to an age where writing obscure code to do arcane things instead of interacting with people in the real world becomes a chore. Or was that just me?

    • TomProfan

      Your absolutely right… I am in in the 40s now.. I like to choose the tools to use and choose the people to work on a project.. but I don’t want to know anymore all the tools into the deepest depth.
      There is too less different, interesting and new to fill it in my brain in ruby, scala, groovy… versus C, javascript, pascal and java…as I really ant to learn them.
      Im still able to read the code but I dont want be able to write it myself in a fast way…

  • TomProfan

    Or from Pratchett =>

    I think perhaps the most important problem is that we are trying to understand the fundamental workings of the universe via a language devised for telling one another where the best fruit is.