Node.js 101

What is Node.js?

Node.js is a runtime enviornment that allows you to run Javascript on a server.

Node.js was created in 2009 by Ronald Dahl to provide solutions to issues he was experiencing with existing web servers and coding methods struggling to handle high-volume concurrent connections. He introduced it at the Annual European JSConf which immediately generated a lot of enthusiam and was quickly backed by Joyent, a cloud computing and hosting provider. At the time, Joyent also had investments in Ruby and providied services for LinkedIn, among others. LinkedIn was one of the first major companies to use Node.js for it's mobile application backend. It is now used by such companies as Uber, Ebay, and Netflix.

Built on Google Chrome's V8 engine, Node.js is an open-source and cross-platform enviornment. It is often used for building back-end servers for APIs, which are the services that power user-interface applications. But Node.js is also capable of powering an entire site using a unified stack. It's runtime enviornment (RTE) contains web APIs that pair with a Javascript engine which parses the code. This makes Node.js a lightweight, flexible, easy to deploy tool with the ability to be full-stack.

Basicially, Node.js allows Javascript to be ran on a server versus only running in the browser. JS as a language was mainly used for building user-interfaces. With Node.js, JS can now be ran on the server and build much more complex and sophisticated applications. It is capable of building highly-scalable, data-intensive, real-time apps.

Another Node.js Logo (large)

Paypal claims that when they rebuilt one of their Java and Spring-based applications, they found that this resulted in two times faster building with fewer people, 33% fewer lines of code, 40% fewer files, doubled the number of requests served per second, and 35% faster response time. Wow!

The main benefits that Node.js provides are as follows, but not limited to: providing seamless JSON, can be utilized full-stack, agile developement, non-blocking I/O, V8 Engine, highly-scalable with microservices. Let's break down those last three benefits, which are arguably Node's biggest advantages over other programming tools.

Unlike PHP, Node.js uses a non-blocking I/O model. It is single-threaded which means things are accomplished asynchronously using a "single-threaded event loop model" architechture to handle tens of thousands of concurrent connections. This event loop supports concurrency via events and callbacks.

The engine used to build Node.js was originally developed for the Chrome browser. It is written in C++, and is used to compile functions written in JS into machine code at a super-fast rate. And thanks to Google investing heavily in it's engine, Chrome's V8 is consistently updated and thus Node.js is as well.

Being that Node.js is so lightweight, it makes a great choice for microservices architecture which breaks down a large application into smaller sections. Breaking up an application into smaller modules allows for greater flexibility and helps lay the groundwork for further growth. It is much easier to build scalable apps this way, because you can keep adding to an existing project more efficiently.

So, what are the drawbacks? The biggest for Node.js is it's inability to process CPU-intensive tasks. This is because it utilizes Javascript's single-threaded event method. When a CPU-intensive task comes through the event loop, it can slow things down since Node.js would use all the CPU available to process it before moving into the next task.

Next, in order to code in Node.js efficiently, you need to be profficent in Javascript. Due to it's asynchronous programming, Node.js relies heavily on callbacks which can easily become a nightmare if they get nested too deep in inefficient coding making it difficult to understand and maintain.

Lastly, even though one of the major perks of Node.js is it's large open-source community, it can come with a price. Even though it is supervised by Joyent and other major contributors, the open registry lacks quality control. Search for tools at your own best judgement, and know that it can be polluted with poor code.

Learn how to use Node.js!

Check out the following free tutorials as well as the Node.js official documentation links below.

Let's explore the Node.js community!

The Node.js official documentation's "Get Involved" section is the place for all things Node.js community.

Head to the Node.js official documentation's "Get Involved" section. Here you will find a link to the GitHub Issues List which is the best place to post questions concerning help with implementation. They also link to the Node.js community Twitter and the Node.js Foundation calendar with all public team meetings. A great feature is at they also provide links for international community resources.

There are over 200k users on this Node.js Reddit Forum dedicated to anything concerning Node.js. You can also find similar community forums on DeveloperFusion and StackOverflow.

Take a look at two major companies that use Node.js!

Both Netflix and Yahoo! have been using Node.js with incredible results.
Netflix.com Screen Shot
Netflix's entire user-interface is built using Node.js which is responsible for reducing the startup time for their app by 70%. With 192 million subsribers worldwide, they require a lightweight, modular, and fast application, which Node.js delivers. It has proved so effective for them that they plan on incorporating it further into their stack.
Yahoo.com Screen Shot
At Yahoo, they invested an entire year towards converting both it's client and server-side applications to Node.js. Every application that they have converted to Node.js has experienced an increase in performance, and they have incorporated it into most of their pages.

So, is Node.js worth learning?

Node.js is well worth learning, and may be one of the greatest tools for full-stack developers today.

With the demand for full-stack developers on the rise, it seems like Node.js is tremendous asset for the job market today in web developement. Furthermore, with the growing need for building fast, scablable networks capable of handling a vast number of simultaneous connections, Node.js reigns supreme. The thing about Node.js is you have to know when and where you can use it in order to be able to extract the benefits out of it, which are very appealing.

According to Toptal.com, "If your use case does not contain CPU intensive operations nor access any blocking resources, you can exploit the benefits of Node.js and enjoy fast and scalable network applications." From what we have seen Node.js do for companies like Netflix and Yahoo!, it seems that many major companies will have their eyes on Node.js and be looking for that skillset in developers.

www.000webhost.com