back to overview

What is polyglot programming?

by The Jexia editorial room

Do you work in a dev team that can write in and switch to a wide variety of programming languages? Are most members dedicated for the long term? Does the team need to deploy and deliver complex projects at high pace? Then polyglot programming could be a great approach.

Polyglot programming exists of software engineering in more than one language within the same context. For this you need an accomplished team, because let’s face it: the classic story of the tower of Babel shows that the results of humans communicating in different languages, while working together in the same context, can cause serious problems. 

But if your team can communicate quite smoothly, mastering most common programming languages, the end result exists of lots of saved development and maintenance hours.

Why write in various languages?

Polyglot programming can elevate the quality of software ‘under the hood’, as the approach dictates us to always integrate the best solutions from all available languages. For instance, SQL is generally mentioned as your best option for databases, scripting languages are often used as glue that integrates various programs, and C is frequently applied for low-level code. The idea is that if you always use the language that suits a specific job the best, you will end up writing and maintaining less code. The result: less time spend, higher code structure quality.

Important to know is that the vision of polyplot programming is based on assumptions. The ones supporting it, assume developers stay as productive as ever, regardless of which programming language they will use. From their perspective, the thought and working process of a developer can be simplified as ‘naturally applying solutions in the appropriate languages’. 

The hard-core polyglot believers go even a step further: aside from applying the right language, they assume software developers will make use of the right programming paradigm in the right context, whether the language has to be written in a logical, functional or imperative way. For example, taking advantage of static polymorphic type-checking in functional programming, a large class of errors on race conditions and deadlocks in communication between processes can be caught at compile time.

Back-end or front-end context

Be aware that the concept of multiple languages in polyglot programming is about using different languages within one context, such as for example either the front-end or the back-end. Otherwise polyglot programming would be everywhere, as the vast majority of software applications exist of a different front- and back-end language (applying JavaScript for both the back and the front is one of the exceptions). Some front-end devs maybe claim they always use three programming languages, with JavaScript, HTML and CSS, but no: the latter two are a mark-up and a style-sheet language. JavaScript used together with WebAssembly is a better example.

Polyglot programming has been particularly applied at the back-end of software solutions. For example Neal Ford of software consultancy company ThoughtWorks, known as an early polyglot programming pioneer, started to use Ruby, next to the company's language stack of Java and .NET. In the past decade, ThoughtWorks became an active advocate of polyglot programming in the developer scene.

Micro-frontends

Nowadays, the use of polyglot programming is slowly increasing at the front-end, triggered by a new architecture set-up called micro front-ends. This architecture enables development teams to divide their front-end in numerous microservices that can independently operate regardless the code of other front-end components. The German e-commerce giant Zalando is known as a pioneer in this area. 

Although when we would really be faithful to the current definition, polyglot micro-frontends are more a pseudo-version of polyglot programming: they empower front-end teams to serve the best solutions by using the most suited JavaScript frameworks, instead of programming languages. Nonetheless, the basic advantages are the same: saving development and maintenance time, while enhancing code quality. 

Please apply with caution!

Just please make sure you don’t jump on the polyglot train when employee turnover in your team is high, or/and when your team members aren’t proficient in a wide variety of languages. Otherwise, polyglot programming will even slow you down. 

Curious about other approaches to speed up software development with high quality code? Check our proposal!