Why You Need to Learn More Programming Languages.

About My Open Relationships with Programming Languages.

I’ve been programming for around 4 years now. I started with C# doing game development, then moved to python for machine learning. Learnt Javascript and Typescript to do front end. Then I wanted to make mobile applications so I learnt Ionic, React and React Native. To make a more performant backend , Go was the perfect choice. Flutter came out so I learnt Dart to make more mobile applications. I picked up Java for some college classes and PHP while working at Facebook.
 I’m not saying I’m an expert in any of those languages. I’ve have more experience with some languages/frameworks than others. Why I learnt these languages? Because I’m easily enticed. I see a cool feature in some other language, and I want to learn it.

But why am I telling you to do the same? Because you cannot choose the right tool unless you know what all the tools are and what tool does what. Choosing the right tools and weapons can help you win most of the battle. I personally have found it extremely useful in my life. Choosing the right language for the problem drastically reduced the amount of effort needed to solve said problem.

Solving My #FirstWorldProblem

Let me give a very simple example of when knowing the right language saved me alot of time but feel free to skip to the main points section. A couple months back I was looking for bluetooth headphones and I decided to go with AirPods. Arguably the best piece of tech Apple has released. I’ve tried many other bluetooth headphones but none of them are as convenient as these. Anyways, the problem was that I use a Windows laptop and an Android phone ( for personal use ). AirPods would automatically connect to my phone but that was not the case with my laptop. I would have to go the settings and connect to my AirPods manually EVERY TIME. This was a painful process because I constantly wanted to switch between my phone and laptop. I needed a button that was always easily accessible that I could click to connect my AirPods to my laptop. 
My first thought was to use python because I was sure that I could find a python library that would let me control the bluetooth of my computer. Not true. There was no well maintained library to do that. The next obvious place to look was at Node.js. Rest assured I found a Javascript library to control bluetooth on my laptop. By running this small Nodejs script I was able to connect to my AirPods immediately.

// App.js
const device = new bluetooth.DeviceINQ();

const airpodsAddress = "18:81:0E:B2:6B:A6"
const airpodsName = "Akshat's Airpods";

device.findSerialPortChannel(airpodsAddress, function (channel) {

// make bluetooth connect to remote device
bluetooth.connect(airpodsAddress, channel, function (err, connection) {
if (err) return console.error(err);

console.log('YAY! Airpods Connected');
        // Don't need a communication stream between the two 
// so let's just exit the stream.
setTimeout(() => process.exit(0), 5000);

});
});

Now I needed an easily accessible button on my screen to run that script for me. I thought I could simply put that script on my taskbar but windows won’t let me put anything there that wasn’t an executable. I made a batch script that I thought I could mount on the taskbar, but was disappointed. Then I thought what language lets me create a .exe ( executable ) file for windows that I can mount on my taskbar? Golang to the rescue. I created this very small script that simply ran my node script.

// main.go
package main

import (
"fmt"
"os/exec"
)

func main() {
output, err := exec.Command("npm", "start").CombinedOutput()

if err != nil {
fmt.Println(err.Error())
}
fmt.Println(string(output))
}

Created a shortcut for the .exe on my desktop and gave it this cute icon. Put that shortcut on my taskbar. BOOM! Done. A simple button always accessible lets me connect to my AirPods very quickly.

I realize that I could’ve also achieved the same result by using C#. But I didn’t want to install Visual Studio a monstrous IDE on my laptop. I could’ve also packaged my Nodejs app into an exe using some other tool like nexe but that’s just unnecessary work.
This is just a simple example of how knowing different tools can help you solve your problems much easily. If all I knew was Python or Java or Go this would have been a very difficult thing to accomplish. I have tons more examples where knowing the right language to use, drastically reduced the amount of time and effort needed to solve a problem.

Main Points

  1. It’s honestly fun learning different languages. Plus it expands your horizons and put you outside your comfort zone.
  2. Another reason to learn more languages is to train yourself to think about problems outside of one language or paradigm. Object Oriented Programming is great but it’s good to also know Functional Programming or Procedural Programming. Once you can train yourself to think about programming outside of your specific language, you will no longer be constrained by its limits.
  3. The first language you will learn will be difficult and the second will be even harder but after that it’s a walk in the park. It’s just syntax changes and a some gotchas. Then you can learn all about the specific libraries and frameworks of that language.
  4. Another compelling reason I can think of learning more languages is WASM. Web Assembly will let your run any language you want on the browser. This means if you learn more speedy languages like C++, to take advantage of that speediness on browsers and create something awesome like https://squoosh.app/ . More info about that here.

Final Thoughts

  1. If you’re a Javascript or python developer. I would highly recommend learning a lower level language. You could go all the way down to C or C++, but I would suggest Golang. You can easily get C++ like speeds without the frustrations of C family.
  2. To all the low level language developers, try out python or Javascript. If you haven’t tried these languages you’re missing out. Python is like pseudocode and Javascript is everywhere these days. Both of these languages let you use your low level languages alongside with them. You can write C++ modules for Nodejs and Python. So trust me, it will change your life.

I hope I have convinced you to enter into an open relationship with your main language and get some new exciting experiences.

If you know 2 very different languages, what has your experience been so far? How do you think it has helped you in your career? Let me know down in the comments.

P.S — I hope you enjoyed the article. This was my first one. I would really appreciate some feedback. Please leave it down in the comments.