What is node.js for?

Once upon a time the Internet was born. Among all the various protocols we could communicate with (e.g. email, file transfers, etc.), one protocol in particular rose to popularity: HTTP.

HTTP is today known as “the Web”. It was essentially people typing up information, sharing the information, and people consuming that information.

Web “browsers” were soon born – including Netscape. These were just different vehicles to browse the web, sort of like different cars traveling along a highway.

Reading information was not enough. Quickly, the need for interaction with these “web pages” was needed. Imaginations went wild and a new language was invented called JavaScript. It was named JavaScript because Java was popular at the time, but it has nothing to do with Java.

So, web browsers were upgraded to include a JavaScript interpreter that can run JavaScript. Web developers began using JavaScript to upgrade their web pages to include cool interactivity, animations, intelligence, and logic. It allowed the developer to make web pages interactive and dynamic rather than just have basic static data.

Combined with a server-side language (e.g. PHP, Python), you could now build full-blown web applications. Imagine that… software was no longer being developed to be downloaded/installed/executed. You could simply navigate to Hotmail and manage your email account – all from within your browser. Microsoft Outlook was no longer needed. Why purchase and download software when you can just access it via the browser? Web-applications were officially born.

The world was happy.

Until, developers began pushing the limits of what they could do with web applications.

However, someone at Google was getting very frustrated at the pace of the Internet advancing. Web browser technology was frustrating, out-dated and lazy. So, Google did what Google does best: they approached the problem from the ground up. In fact, they literally solved the problem by building a browser from the ground up: Chrome. This time, they chose to build the actual JavaScript interpreter as a stand-alone project. They called this new JavaScript engine “V8”.

V8 was awesome. It was insanely fast. It was stable. It was beautiful. They used almost every possible computer science trick in-the-book to optimize how JavaScript was executed. This was back in 2008.

In 2009, a guy named Ryan Dahl had a brilliant idea. He thought to himself “Google Chrome is a great web browser partly because of the V8 engine, but what if I moved V8 to the server side and executed JavaScript on the server?”

This idea was, and still is, brilliant.

Why, you may ask?

JavaScript is a programming language. For all intents and purposes, it is a full-fledged programming language with all the necessary capabilities to build a web (software) application. The way you could develop in PHP, or Python, or Ruby, you can also build in JavaScript. The same way PHP code is executed using the PHP interpreter, JavaScript is also executed using V8.

So, Ryan took V8 to the server, built a small layer around it (to manage the runtime capabilities of JavaScript on the server) and called this new interpreter Node.js.

Developers jumped for joy. Here is why:

  • They don’t have to switch languages between the browser and the server. Developing the entire application in JavaScript now became possible. Yeah, all that stuff you did in Python and PHP, you are now doing in JavaScript.
  • Technologically superior because of its non-blocking, event-driven model.  Node.js can handle far more traffic, on far less hardware, with a far smaller development team, iterating new features in far less time. Yeah, it really is that badass.
  • Blank canvas – all the lessons learned from the past 30 years were now being ported over to Node.js. Libraries, methodologies, etc., were all being built from the ground up. No “legacy” code. No nasty libraries built by inexperienced scripters from the 1990s. All brand new.
  • Node.js package management. Similar to pip, yum, composer – Node.js has its own package manager called npm. Everything we all ever learned about package management was finally done right! Go to npm and see for yourself. Beautiful, clean, solid modules. Over 100,000 of them available for you to build your app like a Lego set.
  • Economics – with all these advantages, you can understand why the enterprise began to put its weight behind Node.js. Today, you have companies like Walmart, Yahoo, PayPal, and eBay all running Node.js on the front end.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s