JavaScript ranks as one of the most popular languages for developers across the world. With the rise of Internet and mobile devices, JavaScript has evolved too. For some reason, till date, I had never paid attention or understood how various frameworks work at a 10,000 ft view. Since I never really worked or learned this space, my understanding was really vague; In my mind, JavaScript equates to some script that helps with interactivity on the browser side.

Became curious to at least understand the various types of frameworks popular in this space and here is what I have understood as a rookie:

There are people specializing as full stack developers - well, it looks like an oxymoron - how do you specialize on the entire stack of building an application. In any case, keeping that aside, I understood that NodeJS is essentially a C++ library that extends JavaScript functionality. What is JavaScript functionality and who defines it ? ECMA is the org that comes up with JavaScript specs that various engines implement it. V8 is a popular engine from Google that is open sourced. The good thing about V8 engine is that it can be embedded in to any C++ code. NodeJS embeds JavaScript V8 engine, and has a ton of C++ code, thus making it in to a modern web server.

What are the capabilities that NodeJS creates via its core library?

  • Ability to read and write files
  • Ability to communicate over the Internet
  • Ability to communicate with databases
  • Ability to spin off tasks to enable asynchronous programming
  • Ability to manage the various packages required for development and production via npm package manager
  • Ability to organize code in to modules

As one can see, the above features are not specified in ECMA - well, except the last point on modules that was introduced in the ES6. The fact that community has taken pains to write C++ libraries that extend JavaScript functionality, is what makes NodeJS quick and powerful server side technology. This means that that NodeJS can outsource ECMA updates to Google’s V8 engine and focus on writing C++ features to extend JavaScript functionality. Needless to say, this ability to extend native JavaScript has spawned a million open source packages. As of today, there are 1.3 million packages registered on npm. That makes NodeJS the most popular open source project in the entire developer community

What about JavaScript on the client side ? For every request sent by NodeJS, the browser needs to create a DOM tree, invoke the JavaScript engine such as V8, that manipulates the DOM. This manipulation of the DOM triggers a subsequent change in the page display on the browser. There is a whole world out of JavaScript frameworks that are available on the client side. Frameworks like Angular, React all fall in this category where they enable efficient way of packaging reusable client side components so that DOM manipulation on the client side becomes hassle free.

This means that one needs to carefully design the JavaScript code based on whether it is doing something on the server side or client side. Ofcourse there are always decisions to be made on which engine should be used for what task. May be it is better to have a piece of task done via server side NodeJS engine or use components such as express and templates. May be it is better to get something done on the client side using frameworks such as Angular. To make such decisions, I guess one needs to have a clear understanding of the way code from NodeJS interacts with code from front end frameworks such as Angular and React

Does it make sense for a data scientist or ML engineer to learn JavaScript, NodeJS and let’s say some framework such as Angular ? I have always felt that the limitation of working with Python or R world is that one can build single page apps only. Yes one could learn flask and build a full fledged web app using Python but then one would also need to learn quite a bit of JavaScript to handle client side interactivity. In the case of R, all one can do is build single page app via shiny. I like shiny as one can avoid JavaScript completely. You can do everything in R and the shiny package takes care of the rest. I have tried avoiding looking at JavaScript space for many years. Why? Many reasons but one of the things that stands out is that it appears complicated, tedious and not really geared towards data munging and modeling. Having said that, the fact that many data science prototypes and demos are being showcased via full stack developers is an indication that it might make sense to develop skills to create a quick multipage app via JavaScript frameworks. May be the APIs that crunch summary stats or the APIs that spit out model output could still be written as Lambda functions deployed over cloud, but there is nothing that stops a data scientist to leverage all these wonderful frameworks to build an awesome web app.