Years back in 2013, I was working in a Hospitality management system. The application was used by front desk staff in star hotels. It helps to check in or check out rooms, book appointments and offer several other services. The entire application was written C#. Yes, you hear it right - the whole application including the user interface was written in C#. It was a desktop application and they used to install it in high resolution touch monitors backed by Windows OS and keep it in reception.
The UI was powered by Windows Presentation Framework (WPF) and backend was using ASP.NET Web API. Even the database layer was abstracted using Entity Framework - one of the popular ORM in C#. I didn’t remember writing a single native SQL query in that project.
It becomes a problem when the customer wanted the same application in web, since they have hard time provisioning the system, installing required dependencies and managing updates. So we proposed to build the web interface using Silverlight. Silverlight is a web platform used to build rich web interfaces using C#. (The technology is dead now). Our competitors were starting to explore AngularJS and React, while we stuck with a technology that was about to deprecate.
It was all happened because our limitation in the capability. Apart from organization perspective, it also created problem to the individual’s learning. Our team has a great expertise in C#. We know each and every feature in C# and how it works. But we never know why some of the design decisions were made in that programming language. Many of the language decisions started to make sense, when we start learning other languages.
The option to pass by reference (ref and out) and pass by value feature in C# makes more sense, when I learn about borrowing feature in Rust.
I understood the actual purpose of dynamic keyword in C#, after I experienced the power of dynamic programming in Python.
Lambdas and anonymous functions in C# started to make sense, when I explored functional programming in Haskell.
The necessity of two way data binding in WPF now making more sense, after I learnt the problems of bi-directional data flow and how Redux solved the problem with Flux design pattern (uni-directional data flow)
The moment you start learning other languages, it opens up a lot of new boxes in your brain and you will be able to view programming languages from a different perspective. I like the way Uncle Bob Martin put it.
The reason to learn a new language is to create new neural pathways in your mind. - Uncle Bob Martin
Polyglot programming is the practice of writing code in multiple languages to capture additional functionality and efficiency not available in a single language.
There are lot of media sources already talking about advantages of polyglot programming. And my favorite is the interview with Neal Ford (Director, Software Architect, and Meme Wrangler at ThoughtWorks), discussing about the benefits of Polyglot Programming.
In this article, I want to talk about few ideas that will help us to advance in the direction of becoming a polyglot programmer. Polyglot programming doesn’t mean learning and being an expert in every programming language.
It is the matter of understanding the high level programming concepts and having awareness about evolving new language features.
Understanding multiple languages becomes easier, when you are strong in programming fundamentals. When I say fundamentals, I mean the overall fundamental building blocks that make up a programming language. Consider type system - the nature of type system varies from language to language. A language could be either static or dynamic typed. It could be either strong or weekly typed. Or untyped (WebAssembly). Try to understand the rationale behind those design decisions. Some languages like C, C++ are statically typed, because type information is not available during run time. So they have to do type checking at compile time. Python has a sophisticated runtime, which can do type checking on the fly. So they don't need type information at compile time. Understanding these kind of fundamental working model will help you to pick up any new languages easily.
Similarly try to understand other building blocks like memory management, execution environment like whether it is compiled or interpreted, executed by processor or virtual machine, the nature of threading. Also compare these features with the programming languages you already known. That helps you to get more insights on why certain design decisions are made. For example goroutines(lightweight threads) might be the result of costly nature of OS threads in Java.
The common problem in Polyglot Programming is, when we try to master multiple programming languages, we may tend to lose the best practices in that particular language. A programmer who code Java for 10 years may follow good practices when compared to the programmer who practicing the language for an year. But that doesn't mean polyglot programmer write bad code. With proper understanding of language agnostics best practices, we can definitely write good code in any language. I recommend books like Clean Code (by Uncle Bob) and Refactoring (by Martin Fowler).
Write code that is readable, testable and extensible. You will always end up in a design pattern. Understanding the concepts like modularity, dependency management, composition will help you write efficient code in any programming language. I would say all the best practices rooted in the modularity. The level of modularity in your code decides the robustness of your code.
Be open minded
Taste the unique features
When you learn a new programming language I bet you the first ten chapters would remain same in all languages. It include data types, variable declarations, conditional operations, functions and structures. But the last few chapters introduce the key features of that particular language. Being aware of the key features in a programming language will help you to choose the right tool for your problem. When you learn a new language, identify the key features and practice examples based on the key features. If you are learning Go, create a simple webserver and see how efficiently you can handle multiple requests concurrently using goroutines. If you are learning Rust, try to create simple image processing library and run it from browser using webassembly. By doing that you can understand the ease of manual memory management and the power of webassembly.
Adapt the changes
Learning is fun. Learning new stuff is always exciting. No matter what we do, we cannot learn everything in our lifetime. Learning is an ongoing process. I would like to remind the words of Steve Jobs, which suits all the time.
Stay hungry. Stay foolish.
I myself sometimes ask whether I am a polyglot programmer. If you ask me how many programming languages I know, I cannot answer that question. I didn't even know how many languages exists at this point of writing this article. But if you give me a problem and ask me to solve it in any new programming language, I have the confidence that I can solve it. If that means a polyglot programmer, then of course I am a Polyglot Programmer.