Node.js - A Web Server Designed for Web Programming

Forewarning: This is my opinion about Node.js after about 2 months.

Node.js in one word: Purposeful.

Correctly designed for the purpose its meant to fulfill.

So for the past week I've really dived into the Node.js world. How come? Because I'm creating a poker game called FreeRidePoker. Its a poker website where users can play Texas Hold'em for free. After doing some research I decided to go with Node.js for the following reasons:

  • It has good performance.
  • Server and client languages are the same.
  • Exposure to new design principles and technologies (MVC, Routing, Sockets).
  • No need to learn a new language.
  • Easy to install.
  • Relatively light-weight when compared to Apache+Module(s)+Modules' Dependencies.

All I can say is that Node.js has blown my mind. Java/JSP is too rigid. C#/ASP is restricted to Windows, requires the massive Visual Studio, and quite overly complicated for some things, but Razor/MVC is really helping with this (and should be considered by many if they have a Windows development environment available to them). PHP is inconsistent. Python/Django doesn't have the performance many need- but much easier to maintain than the alternatives... and I can't say anything about Ruby/Rails because I've never used it. Oh, Perl too.

Node.js though is simple (in terms of use). Node.js talks in events, requests, and responses. Node.js is backed by almost the fastest interpreter ever, V8. JavaScript code can be somewhat consistent to an extent (more so than PHP at least). Most importantly though Node.js is the embodiment of the web ideology.

The Node Package Manager (NPM) must be the next best thing about Node.js. It is similar to *nix package managers, and other package managers offered by alternative programming languages. NPM opens up an arsenal of modules to use in your project. Need a sha1 function? Alright then, lets not reinvent the wheel for once, and install a module that provides this:

npm install sha1

...that's all? Yep, that's all, and nothing more. It's almost like shopping but completely free.

But how do I use it now? Sure it may be installed but what about setup?! Well, once again, Node.js has you covered:

var sha1 = required('sha1');

Other programming languages offer the same functionality, but what separates NPM from the others is it installs modules to a project's directory. I can only imagine this setup exists because modules develop fairly quickly and end up breaking projects.

Another great thing about Node.js is that you aren't reliant on an IDE to take care of the magical code, directory or file generation. You can begin writing a Node.js application in your favorite text editor. My setup for Node.js development is my favorite text editor (yes I'm being ambiguous purposefully), a terminal and a web browser. So simple, yet effective. 

The only real downside to all of this, that I've encountered, is the JavaScript begins to be difficult to manage after you have more than two handfuls of files. The abstraction hell starts to kick in and the headaches arrive. I'm sure with more time and experience this pain could be numbed.

All in all, I'm really trying to say this: please for the love of god use the correct tools for software development. Node.js will save you so much time and headaches when it comes to Web development. Not saying PHP, ASP or JSP are the wrong tools, but C# and Java were not designed for Web development and PHP is generally known to be shit; JavaScript is a Web development tool that's at least less shit than PHP.

...Have fun!

Comments

Popular Posts