JavaScript: Shooting For The Stars? Literally!

Share

The popular multi-paradigm scripting language has literally made its way to space following the Space X dragon 2 launch which leverages chromium and JavaScript for a significant portion of its user interfaces. The dragon is one of the first spacecrafts to provide touch interfaces to some of the mission-critical and access redundant systems.

 

So how did a lightweight, interpreted language made its way to the forefront of human innovation? There are several potential factors that have fueled this advancement. First of which is the light weightiness of JavaScript. Although JavaScript started as a programming tool to bring interactivity to HTML pages, now it runs on everything from huge servers of multi-million dollar companies such as Google to small microcontrollers and even small home appliances on your kitchen desk. This is mainly because of the flexibility that JavaScript provides, and its ability to run everywhere.

Initially, JavaScript ran inside the JavaScript engines such as V8(chromes JS engine) and spidermonkey (Firefox JS engine). But it has made its way out of the browser and can now run in many places. If we look at the charts, Javascript libraries such as React and Vue is dominating the front end while Server side technologies such as Node has enabled JS to create fully-fledged backends. Also, frameworks such as electron JS has enabled the developers to create desktop applications. JS can even run on mobile devices. (React native is one of the most popular mobile frameworks that runs on both IOS and Android). This platform independence has made JavaScript the true “Learn once, code anywhere language”.

Unlike Java and many other languages which has multiprocessing capabilities, JavaScript or Node to be specific is a single-threaded language meaning that we cannot leverage threads to achieve performance increases in a multi-processor environment. Instead, JavaScript relies on a concept called asynchronous programming which manages I/O bottlenecks effortlessly. In an asynchronous program, when an I/O operation is called the programs continues to execute its logic without waiting for the I/O request to be completed and falls back onto the I/O request upon it being handled. Generally, input heavy applications tend to run better on asynchronous languages while computational heavy tasks might create bottlenecks. But with the introduction of concepts such as JS worker threads, Node can easily do computational heavy tasks as well. This capability has greatly enhanced the popularity among the tech community.

 

 

From the above graph, it is apparent that JavaScript has become the go-to programing language for many full-stack developers in the silicon valley and is among the highest-paying jobs. While the aforementioned reasons have certainly paid diligence to JavaScript becoming popular, the most important reason for JavaScript to gain traction among the tech community is its support for many programming paradigms. Unlike Java, which only supports object-oriented programming or C++ which only supports functional programming, JavaScript gives the flexibility to the programmer without constraining them. It also handles low-level tasks such as memory allocation, pointers and garbage collection under the hood, so that the developer does not have to worry about them.

Despite inheriting all the advantages from both object-oriented and functional programming constructs, JavaScript has remained an interpreted language meaning that it does not have to be compiled. It is also a loosely typed language that gives the developer the freedom to dynamically assign values to variables easily. Also with the introduction of ES6 (ECMAscript 6) writing code has never been easier. Concepts such as arrow functions and template strings enable the programmers to write clean and understandable codes that are memory efficient.

Reasons such as these have enabled Javascript to be at the epitome of programing languages.

 

Written by: Lasal Sandeepa Hettiarachchi

 

Image Credits:

Featured Image: https://bit.ly/2PWh7qA

Content Image 1: https://bit.ly/2RxlJDL

Content Image 2: https://bit.ly/3xT5bqw 

 

References:

https://www.infoq.com/news/2020/06/javascript-spacex-dragon/

 
Tagged : /