Issues with Polyglot Programming

BASARAT
3 min readNov 11, 2015

--

In computing, a polyglot is a computer program or script written in a valid form of multiple programming languages

Disclaimer : There is no doubt that working on a project with multiple programming languages (especially languages with differing paradigms e.g. C# vs F# vs. TypeScript) will greatly increase your developer’s aptitude and perhaps even overall happiness (learning multiple programming languages is a requirement for being a good developer … getting paid to do so is awesome).

That said … there are real issues that I believe are fairly obvious but people either fail to acknowledge or fail to admit upfront. I’ll try to be terse here. Note that these examples are real world about languages that were designed by the same people for the same developers.

The competent programmer is fully aware of the strictly limited size of his own skull

- Edsger W. Dijkstra

Browsing Code

Code Navigation is a pain (and you are mostly left with string finding). For example, if you open a F# file and navigate to a function defined in C#, this is what you are left with:

Build Cycles

You need to build F# to use in C# and vice versa. Need to use the similar code in safety in TypeScript -> need to author a code-generation routine and run it.

Code reuse

If you want to use some code (or logic) from C#/F# in TypeScript you need to write a code-generation routine.

Refactoring

No one language service understands all the languages. A simple rename refactoring (the joy of statically typed languages) quickly turns into a find and replace + compile loop.

StyleGuide

Each language has its unique style guide. This is only natural. If you want to work on a multi paradigm project be prepared for this. There is a cognitive overhead to switching languages. I’ve seen way too many C# developers writing PascalCased JavaScript function names.

Saunter

Its a knows fact that in industrialization that as people move from task to task they don’t walk … they saunter. It feels the same even moving to CSS from JavaScript.

Module Systems

Each programming language has its own module system. C# developers use Nuget, F# developers are moving to Paket. TypeScript developers need npm and tsd.

Build Tools

Different languages, different build tools (at the very least different compilers), multiple compile cycles, not fun.

Developer Expertise

Based on your team size and company ethics, the developers might find it hard to shine in their own way. Jon Skeet is known for C# (doesn’t mean he doesn’t know expert level Java or F#), Alex Martelli for Python, Tomas Petricek for F#, Steve Fenton for TypeScript. Becoming an expert can be hard (and slower) if you are constantly switching context.

Summary

As we work on increasing complex projects (e.g. checker.ts) we need increasingly advanced developer tools. Limiting yourself to a single programming language makes the problem much more tangible and maintainable.

Its good to be polyglot, keep an open mind and use the right tool for the job (don’t create an operating system in ruby). But don’t deny the mental cost, and discount the advantages of a unified language / workflow. But I guess you already knew that 🌹

If you liked this post don’t forget to click that green heart below.

--

--

Responses (1)