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

Beware the Ides of March...in 9 days

Stupid heading for this blog, but whatever.  I was amused.   So, a lot has happened since my last entry, which I believe was sometime in January.  I have officially started a new business -- OnlineFixShop, LLC.  The web address is http://www.onlinefixshop.com/ .  Check it out!  For the next few months, my business will be focusing on home PC repair.     I am offering services that can help you:   Rid your computer of spyware and viruses Retrieve lost information and data Gain access to the Internet Increase your computer's performance and speed Learn your way around various types of software Setup a secure wireless or wired network Back-up personal and valuable data Secure your computer(s) and protect your data Eventually, I am planning to focus on repairing computers over the Internet using remote administration technology, which I have yet to design.   Right now, I am working to setup an onlin...

JavaScript Sticky Footer and Scroll Effect

This post talks about two different HTML/JavaScript effects: How to keep a page footer stuck at the bottom of the browser window. How to create a scrolling <div> without using a scroll bar OK. So... you have a website. You want a header stuck at the top of your page and the footer stuck at the bottom of your page. The stuff in the middle, you want to be able to scrollable. But, you don't want those ugly scrollbars to the right of your scrollable text. Maybe, instead, you'll have up arrows and down arrows above and below your <div>. When you mouseover the arrows, the text in the <div> will move up or down and create a scrolling effect. Suppose your page looks like this... <html> <head> <title>Test</title> </head> <body> <div style="position: relative; width: 700px; margin-left: auto; margin-right: auto;"> <div id="header">Header</div> <div id="scrollUp...

Today's Quote

This is simply a brain dump.  I'm sleepy, and I want to type out some of the thoughts currently in my head. "Luck is where preparation and opportunity meet."  This is so remarkably true, and today I'm making it a mantra.  I believe that luck is merely an illusion that we perceive, but it truly when we have prepared ourselves for the right opportunity... and then a great opportunity comes along.  Many great opportunities pass us by every day.  Once we begin to recognize them and prepare for them, then we start to experience the thrill of luck. Interestingly, as described in "Good to Great", Mr. James Collins talks about how "Level 5" leaders often attribute their great success to luck .  That's a humble way of saying, "I planned on taking advantage of every opportunity ."   Hmmm...