InfoSpace Tech Blog

Working in a Polyglot Environment

| | Comments

Websters Dictionary defines Polyglot as a mixture or confusion of languages or nomenclatures. Mixture..confusion…. As computer scientists we’re taught to not co-mingle or mix languages, platforms, metaphors and to write code that avoids confusion. When applying the term polyglot to computer science and taking the definition at face value it sounds just a tad bit negative or like something you want to avoid. It’s hard enough to learn one language/platform well, right? Doesn’t adding more languages into the mix just muddy the waters? In this post I want to give some practical reasons why a mixture of languages/platforms can help you be a better computer scientist and a more productive developer.

You may already work in a polyglot environment and not even be aware of it.

Are you a web developer? Do you write server side code hosted by Apache, Nginx, or IIS? Do you work on mobile applications? Do you make any 3rd party API calls?

If you answered yes to any of those questions you’re most likely already working in a polyglot environment, at least from a language perspective. A typical web development environment, at a minimum, uses HTML, Javascript, and CSS. Calling an API? You’re most likely using XML or JSON as well. Maybe you’re using ASP.NET MVC or Ruby on Rails. All of those scenarios require a polyglot environment from a language perspective. Frameworks like ASP.NET and Rails provide mechanisms to blur the lines of the languages that are used and the frameworks that use them, but you’re polyglot nonetheless.

What can we learn from a polyglot environment?

So what does it matter if I’m aware that I’m working in a polyglot environment or not? You’ll start to ask more thorough questions to the problems you’re trying to solve as you gain more awareness of the environment you’re working in. Being polyglot-aware frees you of the bondage of limiting your solutions to only the constructs available in your language. You start asking yourself questions like:

  • Is my problem best solved using a pattern based around a language/framework construct, for example a Linq expression, or is there a design pattern that better solves my problem that may not already be implemented in the framework I’m using.
  • Is my IDE or programming environment causing me to make workflow decisions that I would not make given a different IDE or programming environment?
  • How do other languages/platforms solve this problem? Are there best practices?

Polyglot environments allow us to learn from the growth of other platforms.

If you’ve paid attention to the evolution of .NET, Rails, Android, or iOS development over the last decade one thing you’ll notice is that each framework/platform has learned from other frameworks/platforms. ORM’s were introduced in the .NET Entity Framework as a direct result of their effectiveness in Rails. The understanding of the problems that ORM developers were trying to solve eventually lead to the NoSql boom that we’re in today.

Android Studio and Interface builder for iOS have evolved, in part (in my opinion), as a result of the tools provided by Visual Studio for building forms/web forms based applications. Android fragments were heavily influenced by the boom in the the tablet market, driven by iOS. The pattern was different but the problem was surfaced and addressed as a direct result of another platform/framework. The UI evolution in iOS around notifications seems to be heavily influenced by their Android counterpart.

Polyglot environments have helped to proliferate language constructs like closures, lambdas, and generics. Even if you haven’t been working in these different platforms/frameworks/languages a lot of the tools, patterns, and language constructs that you use everyday have been heavily influenced by people who do work in polyglot environments.

Polyglot environments allow us to think outside the box

In my experience, patterns tend to emerge quicker for the polyglot developer. I don’t have any hard evidence for why but my gut tells me that it’s because they’re exposed to the patterns more often in different languages/frameworks and so they’re more recognizable for what they really are (a pattern). Once you start recognizing patterns you can more easily differentiate the patterns from the language constructs that implement those patterns. When we’re aware of the underlying pattern being implemented we are better able to utilize the construct implementing that pattern. It allows us to understand the bounding box of the construct and not try to shoehorn a solution into a construct that wasn’t built to solve that problem.

As a polyglot developer you find yourself asking “Why am I solving the problem this way?” or “Is this really the best way to solve this problem?” more often. This leads to better solutions simply because you’re more involved in Why you’ve chosen a particular implementation. In my experience, polyglot developers are more likely to look for others who have solved the problem already than they are to just try to roll their own solution. Rolling your own solution to a commonly solved pattern often times causes us to miss some of the intricacies of the problem or introduce bugs that other frameworks have already squashed.

I’m convinced; how do I start?

Find a problem that you’re passionate about solving. Maybe you like reading RSS feeds, maybe you have a huge collection of books you’d like to categorize, or maybe you’re passionate about a problem with existing solutions that aren’t up to snuff. Once you have a problem you’re trying to solve pick a framework, language, and/or platform you’ve never worked in like ASP.NET, Rails, Android, iOS, or etc and start solving your problem. You’ll have a lot of fun because you’ll be solving a problem you’re passionate about and you’ll be well on your way to becoming a polyglot developer.