Polyglot Programming and the Benefits of Mastering Several Languages
Adam Przewoźny
Posted on January 27, 2022
Originally written by Marcin Zabawa and Lidia Kurasińska.
Why learn one programming language when you can master a few?
Fascinated by the concept of polyglot programming, I decided to make good use of the fact that I know several exceptionally experienced developers and take a closer look at the topic.
The people I spoke to were developers who:
have between 5 and 20 years of experience;
know an average of 7 languages;
may be called “polyglot programmers,” though not everyone is familiar with the term.
Their perspectives were just too interesting not to share.
Why do some developers decide to become polyglots? What are the benefits of continuous learning in software development? Read on to find out!
What is polyglot programming?
“Did you know that there is a group of African languages where there are no separate words for green and blue?” Michał Mela, a fan of natural language grammars, asks me.
“In Russian, on the other hand, there are two words for blue: one is dark blue and the other is for the color of clear sky. It has been experimentally proven that these language features translate into the practical ability to recognize colors. Language influences how we perceive the world. The same applies to programming languages.”
Michał is not only a fan of neurolinguistics, but also a professional polyglot programmer—he knows Java, Groovy, Kotlin, Scala, JavaScript, some Ruby, Python, and Go, as well as curiosities such as Ceylon and Jolie.
Where did the idea for such a range of competencies come from? In the world of professional programmers, there is a controversial statement that almost every seasoned developer has come across: “a good programmer should learn at least one new language a year.”
This opinion is over 20 years old and was formulated in the book Pragmatic Programmer, a classic that invariably inspires successive generations of IT specialists.
The idea of learning a new language each year was controversial as early as 1999, when it was articulated, but today the situation is becoming even more confusing. Multiple languages can be used in several ways. Functional and object-oriented programming, even in the same language, can be a more unfamiliar experience than simply learning a new language from the same family.
What’s more, even within the monolingual ecosystem, there are frameworks that differ so far in their philosophy that switching between them is like switching languages—just compare React, Angular, and Svelte.js.
Despite the controversy, every experienced programmer can code in more than two languages, and some of them code in several or even a dozen languages.
For some of them, it’s a side effect of functioning in the world of dynamically developing information technology; for others, it’s a conscious choice. The best engineers I’ve worked with often repeat the same mantra: “I’m not a Java/Python/JavaScript programmer, just a programmer. Languages are my tools.”
Have polyglot programmers had the opportunity to use such a large number of languages in their professional life? Mostly yes, although the greatest enthusiasts also learn experimental and historical languages, with no prospects for commercial use. We are talking about languages such as OCaml, LISP, Haskell, and Fortran.
It’s worth adding that the above average does not include esoteric languages, i.e. those belonging to the “just for fun” category: Whitespace, LOLCODE, or Shakespeare.
Why do some people decide to become polyglot programmers?
So what motivates these developers to learn new languages? The first answer is far from surprising. “I remember Ruby’s fall,” Marek Bryling, a programmer with over 20 years of experience, tells me. “People who have been in software for a long time have to learn many languages over the years. That’s the reality.”
The younger generation is also familiar with the “memento Ruby” argument. “The decision to learn a new language is about career planning and risk diversification. Just look at Ruby,” Michał says.
Most often, however, these developers learn new languages ad hoc: by encountering new technological or market challenges. “The labor market used to be different than it is today. It was often easier to find a job in something completely new,” Kamil Kierzkowski, a senior full-stack developer at STX Next, recalls.
So is learning new languages simply opportunistic adaptation to the labor market? Absolutely not! New languages clearly have the power to shape programmers, redirect their thinking, and broaden their horizons—and that’s not the only advantage they bring to the table.
“Let me quote a classic,” Michał clears his throat as he quotes Edsger Dijkstra, a pioneer of computer science. “It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
As you can see, the battles of the supporters of individual technologies go back to the pre-internet era. It turns out that in the world of polarized opinions, being a polyglot can be very helpful. “I know enough languages to know what suits me,” Marcin Kurczewski, an expert in over 10 programming languages, tells me. “Knowing many schools of programming gives me perspective.”
Having this broad horizon allows you to form your own opinions about technology, but it also gives you the advantage of being more exposed to new products.
“It’s obvious for Python programmers to use Prettier, Black, and other code autoformat tools,” Marcin points out. “When I recently started contributing to an open-source C/C++ project, I was surprised to discover that the project’s technical leader rejected similar tools that are now becoming popular in the C/C++ world. He used arguments that Python zealots used 10 years ago.”
Michał echoes him: “Java8 finally introduced Lambdas. A lot of purists complained: ‘What have you done? You have destroyed this language!’” he laughs. “I knew Lambdas from a different language, I had already figured out what their advantages were, and I quickly got the hang of using them in Java.”
What are the benefits of becoming a polyglot programmer?
Interestingly, today, when more and more people begin their adventure with programming from high-level languages, it turns out to be invaluable to gain experience starting from the very basics.
For example, working with C++ helps. “Thanks to C++, I understood how my computer and everything I run on it works,” Marcin continues. “Knowledge of concepts such as stack, heap, registers, memory management is useful in working with a computer, no matter what language you use.”
Marek supports this opinion and gives a specific example from his own area of interest: “Python has an interesting feature: weak references that don’t increment the garbage collector’s reference count. This is a very useful mechanism, but most people don’t understand how it works because they don’t know memory management from other languages.”
This trail leads us to the strongest argument for learning new languages: this practice develops the programming skills we use in the main language we specialize in. One developer convinced of this is Maciej Michalec, author of the polydev.pl blog.
“Problem-solving approaches in different paradigms differ significantly,” he notes. “Python is a nice example of a language where you can write in an object-oriented and functional manner, and it’s useful to know the different paradigms from other languages so that you can use them in Python.”
“Thanks to the fact that I know how something is done in one language, I can better implement it in Python,” Marek adds. “That’s how async.io was created, being mapped from node. This flow of inspiration is possible when we know several languages and this knowledge goes beyond the syntax itself. It’s like traveling—the more countries you visit, the more your mind opens up,” he concludes.
What is the future of polyglot programming?
In our conversations, we also delve into the topic of the future. What new languages and frameworks will be created and popularized on the market? Who will create them? Is it possible that polyglots will also play their part in this avantgarde programming?
“Definitely, and especially those who like history,” Marek says. “After all, in recent years, we have gone back to the 1960s and we are processing what was invented then: event architecture, microservices, functional programming,” he says.
“The cloud? It’s an extension of mainframes. Even dockers result from processing our previous concepts, such as JAIL or LXC containers. What finally grew out of it was Docker.”
So what’s ahead? What other languages will gain popularity? Will there be more or fewer of them? Opinions are divided.
“I can see a certain consolidation trend in relation to a few languages like JavaScript and Python, but in my lifetime we won’t get to any programming ‘lingua franca’,” Marek says. “I am concerned, though, that in some time 90% of programmers will only be able to do high-level programming. The same is already happening with DevOps—few can still work on bare-metal because everyone migrated to the cloud.”
“We’re not threatened by monolingualism,” Maciej concludes. “PureScript and V are exciting new players. There will be more and more new languages, but at the same time it will be harder and harder for them to break through. Today, a rich ecosystem and the support of community developers are of key importance for any language. You can see it in Scala,” he sighs.
“I love this language, but the community is very hermetic and pushes out those who haven’t been dealing with functional programming before. This affects the popularity of the language more and more.”
The issues of community and ecosystem are also raised by Marcin, who is skeptical about Crystal, another contender in the crowded arena of programming languages. “Crystal is a compiled Ruby, and it’s an interesting idea, but even the nicest, cleanest programming language is nothing without a solid ecosystem, which is missing there.”
It seems that programming communities will decide the future of programming languages in a very democratic way, voting with their feet (or rather, with their fingers on the keyboard). In this vote, polyglots also have an advantage—they get more than one vote.
Final thoughts on polyglot programming
While I was writing this piece, I was offered invaluable help by several extraordinary senior software developers: Michał Mela, Marek Bryling, Kamil Kierzkowski, Marcin Kurczewski, and Maciej Michalec. Many thanks to them for that!
If you enjoyed this article, you might also like other resources available on our website:
Posted on January 27, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.