Node.js

Events happening in the community are now at Drupal community events on www.drupal.org.
rayman22201's picture

Ok....so our after-meeting discussion conversation got me to stay up into the wee hours of the night researching all the hype about node.js. Here is my breakdown, for anyone who cares lol:

the one sentence answer:
It is exactly what it says it is, server-side javascript.

the long answer lol:
It is really Ryan Dahl's attempt to implement the event driven programming model into server applications (i.e. apache, ftp-daemon, a REST server), he just decided to use javascript to do it lol. The result is a server side interpreted language, similar to php, python, ruby, etc..., except, well, javascript.

This is really low level stuff, we are talking from the interpreter/compiler level to the web server daemon level. You could theoretically use node.js to write desktop app's or anything else for that matter...basically lol....

Dahl took the chrome JS engine, and added some C++ bindings to it so that JS could talk to the Operating System. Basically all an interpreted language is, is an engine to process the code, and bindings to talk to the O/S. That is a simplification, but it gets the point across...
Dahl specifically wrote bindings that would be useful for network applications (servers). Node.js has has objects to allow for things as low level as straight up tcp or udp connections, all the way up to an http/s parser object (your standard web server).

What is cool is that he actually wrote a fairly comprehensive looking API, so that you can bind your own C++ to node.js pretty easily. The api is really new, and not well documented, but it is cool in theory lol.

So what is the point of the whole thing?
a.)The event-driven model fits into the way the internet works really well(as in faster, better, stronger), but the old school web server applications (cough)Apache(cough), don't really follow the event-driven model.

b.)Javascript has always had the event driven-model basically built in, and it works really well.

c.)You put the two together with some clever C++ and you get, in theory, a really fast, efficient, and scalable application that lends itself very well to the internet. BAM! Node.js

Issues I have with it:

It is still really young, so there isn't a whole lot of good documentation or code available for it yet, but that is rapidly changing.
The application frameworks are just barely getting started, so it could be a year or more until any kind of full CMS is developed for the platform, and it will take much longer than that for such platforms to mature.

To compare to php, they don't even have a zend-framework or code-igniter equivalent yet, let alone anything close to the level of Drupal, Joomla, or word press.

It seems like, as of right now, the best use of node.js is for either specialized or enterprise level applications. It could be really good for some specific web application that you need, and then hook the rest of your site into a more traditional server. Unless you have the resources of an enterprise level team to build anything super big. This isn't because the language or the engine itself is lacking anything, it is just because of the sheer youth of it. There isn't enough code to start from. If you wanted to do a big project with Node.js, you would really be starting from the ground up. Which is really cool, just a whole lot of work. (It would be crazy fast and scalable if you did though).

Though if you want to get some serious coding street cred, now would be a good time to get in on developing a framework or CMS for node lol.

Conclusion:
Node.js is pretty cool. It is definitely fast, shiny, and new...I see it as like the prototype for next years new Porsche that they show at the car shows.

Event-Driven programming is a cool concept. The basic ideas have been around for years in low level programming. All modern operating systems use it. The only reason you can still use your computer while your printer is printing is because of an event interrupt system. It's actually kind of funny that it hasn't really taken off on the internet before, but then again, it wasn't really necessary until ajax and web 2.0 came along. It's almost like the evolution of the web is following the evolution of operating systems.

Right now though, Node seems like something to definitely keep an eye on, but not necessarily enough to leave my day job with php just yet lol.


references (check these out for some good reading):

A brilliant explanation of Event-Driven Programming:
http://code.danyork.com/2011/01/25/node-js-doctors-offices-and-fast-food...

A cool more general view of server side JS (includes a look at some of Node's competitors):
http://labnotes.org/2010/12/29/2011-is-year-of-the-server-side-javascript/

A really good breakdown of what Node is about:
http://redmonk.com/sogrady/2010/05/13/node-js/

another good breakdown of cool stuff about Node, but a bit more technical:
http://simonwillison.net/2009/Nov/23/node/

the Node.js api :-P:
http://nodejs.org/docs/v0.4.2/api/

Comments

developments with drupal + node.js integration

justinrandell's picture

nice post!

just a heads-up that drupal + node.js integration module is up:

htttp://drupal.org/project/nodejs

Very Cool

rayman22201's picture

That is very cool. A great use of Node.JS. Basically use it for all the realtime features, thus taking a huge ajax load off of your normal
server, and leaving the traditional page loads to use good ol' Apache. That is more creative than I could come up with :-P.


"If you give someone a program, you will frustrate them for a day
but if you teach them how to program, you will frustrate them for a lifetime."
(Programmer's curse)

Great post Ray! I'm still

z3cka's picture

Great post Ray! I'm still wrapping my head around this whole new thing. I was able to get it up and running last night at the vegasjs meetup last night: http://www.meetup.com/VegasJS/events/16608425/ ... would love to see more Drupal folks there. Had a great time with the Zappos guys (and girl :-)).

I will see if I can make next

rayman22201's picture

I will see if I can make next months meeting. It all depends on my school and work schedule, Tuesdays are a bit harder than Fridays for me.
Sounds like a fun meeting though.
I agree that us Drupal devs have to represent :-P


"If you give someone a program, you will frustrate them for a day
but if you teach them how to program, you will frustrate them for a lifetime."
(Programmer's curse)

Las Vegas, Nevada

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: