Alternatives to node js
5 alternatives to Node.js – and does it make sense? Node.js is not a flawless product, it has flaws (use of JS?), some of which have lingered from the early stages of development due to flawed decisions made by Ryan Dahl, remembered a bit in the article How the creator of node.js himself became disappointed…
5 alternatives to Node.js – and does it make sense?
Node.js is not a flawless product, it has flaws (use of JS?), some of which have lingered from the early stages of development due to flawed decisions made by Ryan Dahl, remembered a bit in the article How the creator of node.js himself became disappointed in it. As is often the case, in some cases it is difficult or impossible to find an alternative to this system, especially in the enterprise sector. But if you don’t need to support a lot of legacy code that will keep programmers busy for years to come, you can look at other solutions. You can read about the “Node.js killer” in the article above, some others will be discussed in this article.
“An old friend is better than two new ones.” ASP.NET has a long history. The Active Server Pages technology, which is the basis of ASP.NET services, was developed at the end of the last century. Of course, the duration of development is not always good, but the long life of the product speaks volumes. Although ASP.NET has a completely different way of working, it’s not just an environment to run code and connect modules, this platform for creating web services, it is often used to solve similar problems with Node.js.
While Node.js is the brainchild of a small team and at its most basic form is an environment for running JS programs outside the browser with I/O access, ASP.NET is the typical product of a huge corporation. It initially contains a large number of default libraries, which immediately allow you to start developing. Node is developed thanks to a community of developers, and therefore the system must first be surrounded by all the necessary modules, which is just an incredible amount. The simplest “Hello world!” on Node drags a few thousand files into the system. Moreover, the quantity does not always outweigh the quality, sometimes it seems as if the developers are ready to cram even the “i++” in a separate module, which then will be downloaded a million times, and a sudden update or removal of this package will cause serious compatibility problems or crash npm. In ASP, security and updates are monitored by the Microsoft ecosystem, libraries written by it and other major companies are thoroughly checked for bugs and compatibility problems…
Despite the many differences, one of the main ones is the different approach to distributing computation. Node.js ran everything in a single thread, but with asynchronous I/O. ASP originally ran in multi-threaded and synchronous I/O. The first variant shows greater performance when running services that require very intensive exchanges, but at the cost of some code complication. Recent versions of the products smooth out these differences, with Node.js and ASP.NET applying the async\await pattern.
JS has grown tremendously over the time of its development, but it is still a language without strict typing and loses out to C# which was initially developed under the direct influence of C++, which had strict typing and OOP from the first days. As a consequence, C# is more powerful and solid, it does not need add-ons like TS. But JS, due to its simplicity, is more useful for microservices programming; it does not need complex features of C#.
In addition to the differences in the programming languages used, these platforms have different ideology. In ASP.NET much is predefined, it offers everything ready-made, starting with the file structure, while, starting to work with Node.js, you have to choose everything yourself, which gives more flexibility, but it complicates the development. But ASP.NET has powerful tools for debugging, testing and refactoring.
The only thing ASP.NET is seriously inferior to Node.js is the ease of deployment. Node only needs an engine and a proxy or Docker. The platform can be set up as yourself, or take a ready-made VPS image, which is available from almost any hosting provider. For ASP, while cross-platform, it’s not so easy, and only the biggest Azure-level players have ready-made server images.
Node.js was created as a runtime environment for JS because it’s a simple and accessible programming language that made it easy to implement simultaneous execution of multiple scripts for two-way communication of web application data between the browser and the server. ASP.NET was also created to write web applications, just using different methods. The same Deno consists of several layers on top of the virtual machine that work directly with the server resources. But you don’t have to use complex wrappers from programming languages that don’t execute directly on the server and require virtual machines.
In 2007, the company’s engineers decided that C++ wasn’t up to the current realities of computer technology. It required effective parallelization tools that take advantage of multicore processors and distributed systems, an automatic garbage collector, and some simplifications for better code readability and type convenience.
The developers’ goal was not to create a “better version of C++”, but to make the new language more understandable, based on their programming experience. Go was publicly announced in 2009 and quickly rose almost to the top 10 programming languages (13th place in early 2012). Raymond Dahl himself praised it in expressions like, “Why Node.js when you have such a great language like Go?” But the novelty passed, and the language was almost forgotten until it turned out that its paralleling facilities were good for developing microservices in web applications. This brought the language back to its former popularity.
Several web frameworks have been written for Go, although you don’t have to use them because it has all the functionality you need to program web applications out of the box. Deno was originally written in Go.
Compared with the same Go, it’s not the newest language, its release was in 1995. Unlike Go, it was developed by a lone enthusiast, Yukihiro Matsumoto, who was obsessed with creating an object-oriented, interpreted language that would be better than Python. The language did not gain popularity immediately, not least because for the first couple of years its documentation was only in Japanese. Books in English didn’t come out until the early 2000s, and recognition came when the Ruby on Rails web framework was released in 2005, which quickly became popular, especially when Apple announced in 2007 that it would ship it as part of Mac OS X 10.5.
As with all interpreted languages, Ruby’s speed was relatively slow, which greatly affected the performance of web applications written in Ruby on Rails. Knowing this problem, the author began to develop a version of the language that would lose backward compatibility, but would run much faster, which he did in 2009. The speed increased dramatically and was now on par with web applications running on .NET and the JVM. Thanks to this, the popularity of the framework has increased dramatically. In 2018, the author of Ruby released version 2.6, which implements dynamic compilation, which speeds up applications even more.
Until now, the Ruby language is tightly associated with the Ruby on Rails framework.
Erlang is another programming language created by a large corporation. This time, the Swedes from Ericsson did their best. In 1986, nobody thought about developing web applications; the Internet was still in the making, and the language was created to run real-time systems. For a long time, Erlang was virtually unknown outside the company, which used it for its own internal needs, until in 1998, the management decided to stop supporting its own language and banned its use, requiring developers to switch to Java. This led to the language being released under an open license, and it began to be distributed outside the company that developed it. For a long time it was of interest only to a small circle of scientists, until it turned out that its concept was well suited for development under the multiprocessor architecture.
In 2012, Jose Valim, one of the developers of Ruby on Rails, was inspired by the idea of creating a programming language for high-loaded systems and large websites. The result was Elixir, a functional programming language compiled into bytecode for the Erlang Virtual Machine (BEAM). By basing the language on Erlang, which was developed for programming communication equipment, Elixir has gained unique properties: fault tolerance, hot swapping (changing or rolling back the code of a running program without restarting it) and the ability to work in real time. These properties allow to create reliable high-loaded systems supporting both horizontal and vertical scaling and working 5-10 times faster than similar applications written in interpreted languages (PHP, Ruby, Python). The creator’s place of work influenced the fact that the language uses Ruby-like syntax, and it is easy to learn for those who use Ruby on Rails.
Elixir is currently used in well-known companies such as Discord, Square Enix, PepsiCo, and Sketch.
But if mastering a new programming language is impractical, as well as dragging all of Noda to the server? You could look at other JS execution environments.
RingoJS is a multithreaded platform built on the JVM and optimized to run on servers. The Mozilla Rhino engine is used to interpret the JS code and has an impressive history. It was developed in 1997 at the time of Netscape, and then given to the Mozilla Foundation and open source.
RingoJS applications can be deployed on any Linux platform all the way up to the Raspberry Pi, or on top of cloud platforms like Google App Engine. The modular system of RingoJS is based on CommonJS, you can even use some modules from Node.js. Also the RingoJS engine allows to integrate libraries written in Java.
PurpleJS is another simple JS framework running on a JVM. It uses Nashorn (also Rhino), developed by Oracle, as the JS engine. It’s not a full-fledged replacement for Node, because the framework doesn’t use asynchronous mode and Nashorn doesn’t have CommonJS support, but it’s very lightweight and doesn’t require restarting the service after a code change.
Vert.x is no longer a framework, but a multi-language toolkit that allows you to create fully asynchronous reactive web applications, microservices and network utilities that run on a JVM. Languages supported are not limited to Java and JS, you can also write applications in Groovy, Ruby, Scala and Kotlin, a modular system with a centralized repository is supported and Vert.x is easily extensible and scalable.
It’s funny that the project was first called Node.x, then it was renamed to avoid legal problems, because the goals at creation were the same as Node.js, and Tim Fox (creator of Vert.x) said that he was inspired by the success of Dali and “wanted to make Node.js on JVM”.