CROSS PLATFORM

Move aside Java, NodeJS is not only cross platform, but when developed with the correct structure can be packaged into an executable containing all its own dependencies.

OBJECT ORIENTED

A huge complaint against NodeJS was down to its JavaScript heritage, which frequently involved lots of procedural spaghetti code. Frameworks like CoffeeScript and TypeScript solved these issues, but came as a bolt on for those who seriously cared about coding standards.

Fast-processing and event-based model

There a couple of reasons for Node.js showing such results:

V8 engine

Non-blocking Input/Output and asynchronous request handling

  • Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser. Node.js lets developers use JavaScript to write command line tools and for server-side scripting—running scripts server-side to produce dynamic web page content before the page is sent to the user's web browser. Consequently, Node.js represents a "JavaScript everywhere" paradigm,[6] unifying web-application development around a single programming language, rather than different languages for server-side and client-side scripts.

    Node.js allows the creation of Web servers and networking tools using JavaScript and a collection of "modules" that handle various core functionalities.

    JS Based Framework

    Get Started

    Core Features of NodeJS

    1

    MULTI-THREADED

    One of the most common complaints by people who do not understand node JS is that it is single threaded and if you have an core CPU it will only run on one core. Nothing could be further from the truth, and is another case of “fake news”. In tandem with its non blocking architecture multithreaded apps are also highly efficient.

    Node.js is non-blocking which means that all functions ( callbacks ) are delegated to the event loop and they are ( or can be ) executed by different threads. That is handled by Node.js run-time. Node.js does support forking multiple processes ( which are executed on different cores ). It is important to know that state is not shared between master and forked process. We can pass messages to forked process ( which is different script ) and to master process from forked process with function send.

    NON-BLOCKING THREAD EXECUTION

    MASSIVE SPEED GAINS Perhaps it’s greatest feature is its least understood by those who are considering it and rookies. Non blocking means that whilst we are waiting for for a response for something outside of our execution chain eg loading some data, reading from a database or polling a remote service, we continue executing the next tasks in the stack. This concept is revolutionary and make NodeJS extremely fast and efficient. When it comes to code in loops this is particularly relevant. For example if we have to load 50 chunks of data and each one takes 50ms, in traditional linear execution that would be 50x50 = 2.5 seconds. NodeJS will fire off all of those requests straight away so all those requests go out in parallel and are handled when they return. Typically making 50 requests might take less than 1ms so are time to fetch 50 requests might be < 51ms.

    2
    3

    SYNCHRONOUS CODE EXECUTION

    Non blocking code execution is conceptually more difficult to code than code that runs in a straight line, because we have blocks of code hanging around waiting for asynchronous events to return. Whilst those blocks are waiting to execute maybe some of our variables have changed values eg for our code that fetches 50 pieces of data the index counter will count from 1 to 50. In straight line coding the counter would be at 1 when the first piece of data returns and 10 when the 10th piece of data returns. In our non blocking environment we fired all the calls off as quickly as we could rather than waiting for one to finish before we fired the next. THAT IS A HUGE GOTCHA FOR NOOBS because the counter is sitting at 50 for every returning piece of data (since it got to 50 at light speed). Most NodeJS noobs fail at this point because they do not understand why their code has failed.

    CREATE BOTH SASS, SERVICE AND DESKTOP PLATFORMS

    Whilst originally a cloud web solution, there was pretty rapidly a demand for NodeJS to be usable in desktop applications. The ElectronJS project bridges this gap, amd many common apps are based on electron including Slack, Visual Studio Code, Discord, Skype and many more.

    4
    5

    BEING BASED ON JAVASCRIPT MEANS FRONTEND AND BACKEND DEVELOPERS USE THE SAME LANGUAGE

    Back in the last millenium, backend developers earned many times more than frontend developers and frequently would avoid frontend code in the same way one might avoid a steamy dog mess on the pavement. However the world moved on and people started to realise that rather than slowing the experience down by preparing everything on the backend server it was possible to use the backend server to send the data and leverage the power of HTML5 browser rendering. Having the backend and frontend skillsets merged,buts the brightest minds working together instead of pulling in different directions.

    SOCKETS AND TWO WAY DATA BINDING

    Most of the web is based on a system of request and response. i.e. I ask for a page and the server sends me a page. The early chat apps used to used something called a poll, where they simply asked every second - “are there any new messages”. This approach clearly sucked, and sockets stepped into the gap. Sockets allows a server to broadcast messages to all clients connected a specific group. Not only that but sockets allow on client to broadcast (via the server) to a whole group. Great for chat groups, and even better for data binding. If one user changes some data, all the other users can be updated in milliseconds. Whilst other languages do have socket libraries, NodeJS has an advantage because of its event driven non blocking architecture, which makes it ideally suited to handle sockets. NodeJS was the first to do it well and still does it better than any other framework.

    6

    Event-driven programming,

    Scalable servers

    Why Node.JS?

    Platform architecture

    Node.js brings event-driven programming to web servers, enabling development of fast web servers in JavaScript. Developers can create scalable servers without using threading, by using a simplified model of event-driven programming that uses callbacks to signal the completion of a task. Node.js connects the ease of a scripting language (JavaScript) with the power of Unix network programming.

    Node.js was built on top of Google's V8 JavaScript engine since it was open-sourced under the BSD license. It is proficient with internet fundamentals such as HTTP, DNS, and TCP. JavaScript was also a well-known language, making Node.js accessible to the web development community.

    Contact us
    TOP