Skip to main content

Why Node.JS?

This article is for those of us who have heard all of the buzz about Node.JS and they need to convince their boss or their clients to make the switch.  Or, perhaps... you're not quite convinced yet?

Why Node.JS?

  1. Reason #1 - JavaScript is awesome.  So, in case you didn't know, JavaScript is awesome.  I'll let you read my other blog post for more details, but I'll also summarize for you:
    • The language itself is extremely powerful.  JavaScript comes packed with modern programming language features like closures, dynamic data types, first-class and higher-order functions, prototypes (not classes), lack of concurrency (more on this later), exception handling, garbage collection, and much, much more!  These features help make your code better, keep you from making mistakes, and make your applications more bulletproof.
    • JavaScript is widely adopted.  It's the scripting language of the web.  Need I say more?  Almost any device with a web browser can run JavaScript code.  JavaScript is not going anywhere any time soon.
    • ...and so... You can always find JavaScript developers.
    • Lots of libraries.  Large community - and growing rapidly.
    • JavaScript is fast.  Surprisingly fast.  Generally faster than PHP, Ruby, or Python.... sometimes several orders of magnitude faster.  Thank you, Google, for the V8 JavaScript Engine.
  2. If you are developing web applications, your front-end and back-end code will be 100% JavaScript.  No need to train staff on a new programming language, and you can more easily reuse code from the back-end on your front-end (or vice-versa).  This significantly improves the maintainability of your application.
  3. Non-blocking I/O.  In layman's terms, Node applications don't wait around for slow operations to complete.  Node does not halt execution for any slow, normally-blocking operation (accessing the hard disk, reading from a database, etc.).  In fact, it speeds along to do the next thing in line.  When the blocking I/O operation completes, a callback is executed.  This works incredibly well with JavaScript thanks to programming features like closures.  Bottom line: It's incredibly natural to write blazing fast single-threaded applications that are still capable of handling thousands of concurrent connections.  That's right - it's natural - meaning you have to work extra hard to make your application run slowly, not the other way around.  Non-blocking I/O also means that you don't need to worry about threads - and all of the headaches that go along with them.
  4. Great API and lots of libraries
    • I'd like to give Node the kudos it deserves for such an incredibly powerful, yet simple, API.  Building modules for Node is simple.
    • Node.JS now has the solid Express.JS web framework and all of the toys that go with it.  Building web applications and RESTful APIs couldn't be much easier.  For whatever reason, there are guys like TJ Holowaychuk who write a lot of very good open-source code for Node.JS.  I want to find this TJ guy, congratulate him for his awesomeness, and then ask him if he ever sleeps.  Thank you for Express.JS, Connect, and all of the awesomeness.
    • Real-time, single-page web applications are easier.  Socket.IO now provides a cross-browser web socket API, and it works great in Node.
    • Databases?  Yep.  Node works with all of the popular ones - MySQL, Redis, and many others.
  5. Developing applications with Node.JS is free.  This benefit is often overlooked.  A lot of people use frameworks and proprietary technologies that cost money to use.  Why?
Bad Use Cases - when to avoid using Node.JS
  • CPU-heavy applications - use C or C++ instead
  • Desktop applications - there is no GUI library for Node.JS yet.  That's OK because no one wants to write desktop applications anymore.  The web is the future.
Bottom Line
  • If you're programming microprocessors or writing video encoding software, keep using C/C++.
  • If you are building desktop applications, you should probably be building web applications.
  • If you are building web applications, you should probably be using Node.
Node provides many more benefits than Ruby on Rails, a growing fan base, and the power of JavaScript.  If you are using PHP, ASP.NET, or something older (yikes - no Perl, please), you are behind the times.

Comments

Popular posts from this blog

Wedding Prediction - October, 2013

Carla and I are planning on getting married sometime in October next year.  We need to pick a date, and that decision may  involve some science and mathematics.  :) For example, we want the weather to be nice.  To be more precise, we'd like the high temperature for the wedding day to be between 60 and 80 degrees Fahrenheit.  Obviously, we have both lived in Ohio our entire lives, and we have a pretty good idea of what the weather will be like.  We both hypothesised that October was a "hit or miss" sort of month; it could be cold, or it could be nice. But, for me, a simple hypothesis was not enough; I really wanted to know the probabilities of decent weather based on historical weather data.  Many websites on the Internet (i.e. almanac.com) charge you to review historical weather data, but Carla and I discovered a cool page on cleveland.com that provided exactly what we wanted.  I loaded the historical temperature data from 1903 to 2011 f...

Web Browsers You Should Support

As a web developer, generally speaking, you should consider supporting the following browsers (at the time of this writing): Chrome (latest) - the browser that sets the bar for the others; you should be using it and supporting it Internet Explorer 9+ - the browser that finally caught up with the times a bit; basically, a Chrome wannabe.  I still say that IE sucks... even if it really doesn't anymore.  Yes... I'm sour about IE8 and below. Internet Explorer 8 - the old, sad browser that we sadly still have to support for a while.  CSS 3 is not well-supported here, so we use projects like CSS3 PIE or whatever.  By the way... IE8 sucks.  I can't wait until this comes off of the list. Firefox (latest) - the browser that was once awesome and has sadly suffered recently because it's slower than Chrome... but hey, lots of people still use it. Safari (latest) - Watch out for Safari as more iPhones, iPads, Macs, and more overly-priced Apple products flood the ...

Data Persistence in Various Databases

This blog post will cover the varying levels of data caching and data persistence provided by various operating systems and database systems. Cache  - A device placed in front of another storage device that is used for temporary storage of data.  The use of a hardware cache is often transparent to the end user and is generally smaller, faster, and less persistent than the backed storage device.  Rather than reading/writing from/to a slower storage device (i.e. a hard disk), we read/write from/to the cache (i.e. RAM, NVRAM, etc.). Reading from a cache is simple.  If the datum we requested is in the cache, we simply read it from the cache.  If not, we need to retrieve the datum from the storage device and place it into the cache (often a much slower operation). There are different policies when we write to the cache, though... Write-Through Cache Policy  - When using this policy, writing over the cache also writes over the data on the backed storage d...