on node.js, trendy technology, and the development community

Ok, so I have dived into node.js, as seen on my recent entry on building a realtime, web based, minesweeper clone. I dove into this mostly to just see what all the fuss is about, but I would be lying if I said I was not pleasantly surprised.

This seems to be a topic that one must tread lightly about as node is getting quite a bit of flack as well as quite a few praises and success stories. Seems like a love/hate relationship with no counselor! Why the great divide?

My goal in writing this is to just outline both sides of the story and hopefully give a fairly neutral opinion on the matter but shining some light on all angles. So here goes: (continued after break)

 

1. Development Community:
There is a divide here as there is with almost all new technologies that pick up momentum. Whether its perl, php, ruby, or node.js, there is always 2 sides to the coin. You wind up with the early adopters saying that its the best technology ever created, and these people become evangelists and specialists, swearing by it and throwing it into production as soon as possible.

Then you have the other side of the community, who is extremely hesitant, can find a way to solve the problem in another language or technology, and basically speak negatively of all of the momentum and try to find holes in the young and immature new and shiny technology.

Sigh how come few people seem to be in the middle of the road? Personally I feel like node is a great step forward, but is not the end-all-be-all in the development world, nor is any other language or technology. There is nothing wrong with enthusiasm, and there is nothing wrong with using another tool for the job, but ultimately, that is what it comes down to. Is node.js the right tool for the job sometimes? The answer can be yes if approached carefully. The right answer can also be no. To make this decision one must properly research what the right tool is for the job, given their project's goals, and remove emotion from the equation.

2. What Node Does Well
While node is not awesome in all areas, lets review what its good at:

  • a.) building non-blocking network applications
    By nature of Node's design, it is unnatural to block an application in node. You end up with a lot of callbacks as a side effect of this, but takes a ton of complexity away from the developer, therefore you end up with less code, which is usually a good thing. Just because the developer is able to skip some of the complexity, this should not reflect poorly on the developer.

  • b.) its fast and lightweight
    Node has a great foundation this department. It runs on google's v8 javascript engine, which is basically a VM built from the ground up without any legacy cruft and a small memory footprint. This is the same javascript engine embedded in the Chrome web browser. A lot of work has gone into this, and therefore its exceptionally fast.

  • c.) momentum
    I feel that momentum is heavily underrated by many in the development community at large. Often a new technology comes out, and often it needs a lot of polishing. Some developers as said above will squawk at this and not use it, but as more and more people hop on the bandwagon, more and more code becomes vetted, more and more eyes see it, and before you know it, the technology has matured, and the industry moves on. Node has so much momentum right now that the bad parts are going to become good, and this is happening rapidly.

    There is a healthy amount of libraries already available, so most used network technologies already have a module available to work with.

  • c.) javascript isn't so bad for this job
    Some people simply reject node because of the fact that its javascript. This is completely absurd. Some of the reasons given is that the barrier to entry has been set to low, since everyone knows javascript. This too, is completely absurd. Especially if you realize that sharing code between the client and the server really doesn't add up. (see point below)

    Just because the possibility exists to write server-side javascript, doesn't mean that every web developer that knows javascript is going to start writing high performance messaging components in node. It may intrigue some of these people to actually start learning how server applications and components are built, but there is still a learning curve. People happily using node, are not using it just because its javascript.

    Javascript is a neat language with a c or php like bracket like syntax. Sure it might not be the most beautiful language out there, but with regards to building event based systems, it seems to lend itself well to this task. Yes, there is multiple ways to extend an object, and some of the OO stuff in it is simplistic, but considering that node applications are intended to be small and lightweight server based network applications, not having all of this baggage is not a bad thing, and with the adoption of things like CommonJS, the ecosystem and established patterns are improving.

3. What Node Does Not Do Well

No technology is perfect:

  • a.) security is immature
    Being so new, there is more possibility of attack vectors. This is also changing rapidly, but is a real concern. Nodester in the beta phase of its node.js hosting solution had their entire database compromised. Who's to say if they built it in .net, java, php or ruby the same thing wouldnt have happened, because it surely could have, but the fact is node is young. Production deployments almost always involve a chroot at this stage. Extra precaution needs to be taken when using 3rd party libraries and things of this nature.

  • b.) no threading
    Node is run in a single thread with one big event loop. This in practice works well for building network applications that need to respond rapidly to many clients and/or have many clients waiting for data. It really doesn't work too well for applications that need to do heavy processing. Node is going to address this with the web workers api which behind the scenes will be something like threading, but really is not the point of node, and for most people won't buy them much. People that have multiple cores on their boxes can simply run multiple processes. If your app is not designed to run many versions of it self and cooperate between different processes, then you haven't even thought about scalability yet. Having many single processes spread out over many servers is going to be much easier to scale horizontally than many multithreaded applications spread out over many servers.

    Personally, I feel that node is just not the right tool for the job if you need to do heavy processing. It simply doesn't lend itself to this, and there is limitations on its memory footprint and things of this nature. This doesn't mean that you couldn't offload heavy processing to another component in the application stack, and still use node for what its good for, this is probably going to be a pretty common trend going forward. Someday node may be a better tool for this, but ultimately, exploit node for what its good at. Threading is not one of them.

  • b.) client/server code sharing
    There has been a fair amount of hype specifically related to sharing code between a web browser, and its node.js backed server. I feel like this is hype for a few reasons, but ultimately it all comes down to why? Why would you ever want to have your backend code be the same as the front-end code. I understand and practice the concept of being DRY (don't repeat yourself) but I don't see any use case to re-use code in both places, not to mention the inherent security risks that when addressed, would mean that your code diverges and is now different because you had to add security measures to the backend code.

    At the end of the day, I think the idea of sharing a model or something is novel, but in practice sort of silly. If you want to have a dynamic application that does fancy things there is nothing stopping you from building that and having all the client code be client code and the server code be server code.

    There is surely a level of simplicity and coolness that you can use the same language in your backend code as client code, and that one doesn't have to do as big of a mental context switch, but I wouldn't list this as a feature of node, and wouldn't be upset about not being able to share code, as it doesn't make sense for any use case I have heard of yet.

In Summary
It comes down to using the right tool for the job. Is node the end-all-be-all to building network applications and scaling them? Most certainly not. Is node's single threaded model better than a multi-threaded model? Depends on your use-case.

Asynchronous event based programming is nothing new. It has its place in computer science and won't go away. Node is simply a new way of doing it, and when used correctly can shorten development time, maximize use of hardware, and excite developers. When used incorrectly, it can frustrate developers and might even wind up taking more time.

At the end of the day you must think about your needs. I certainly would not use node to replace a web framework meant to spit out html, just because node is new and cool. But I would use it to build an application that deals with passing messages to thousands of waiting clients. Your mileage may very, but node is an interesting technology worth spending some time to investigate.

Cheers!


Comments:

No Comments Posted

Add Comment:

Your Name:
Your E-Mail:
(Not Displayed)
Comment:
Security Code:99c515cd1f42187dae0bb5970642283e0959955e
Type Security Code:


Back

Tag cloud

  1. 1 entries are tagged with 2007
  2. 1 entries are tagged with 2008
  3. 1 entries are tagged with 2009
  4. 2 entries are tagged with 2010
  5. 1 entries are tagged with altly
  6. 2 entries are tagged with applevalley
  7. 1 entries are tagged with archlinux
  8. 1 entries are tagged with artichoke
  9. 1 entries are tagged with automation
  10. 1 entries are tagged with batcountry
  11. 1 entries are tagged with beats
  12. 1 entries are tagged with bigsur
  13. 3 entries are tagged with bm2009
  14. 1 entries are tagged with bm2010
  15. 8 entries are tagged with burningman
  16. 2 entries are tagged with c
  17. 1 entries are tagged with christmas
  18. 8 entries are tagged with code
  19. 1 entries are tagged with consistent
  20. 1 entries are tagged with cplusplus
  21. 1 entries are tagged with desert
  22. 1 entries are tagged with drinks
  23. 1 entries are tagged with dspam
  24. 2 entries are tagged with dunes
  25. 1 entries are tagged with energy
  26. 1 entries are tagged with esplanade
  27. 5 entries are tagged with europe
  28. 1 entries are tagged with evdo
  29. 2 entries are tagged with flv
  30. 1 entries are tagged with gadgets
  31. 1 entries are tagged with government
  32. 1 entries are tagged with haiku
  33. 1 entries are tagged with hashring
  34. 1 entries are tagged with icecast
  35. 1 entries are tagged with internetradio
  36. 1 entries are tagged with iphone
  37. 1 entries are tagged with linkfinder
  38. 2 entries are tagged with losangeles
  39. 1 entries are tagged with math
  40. 1 entries are tagged with minespotter
  41. 1 entries are tagged with minesweeper
  42. 3 entries are tagged with mix
  43. 1 entries are tagged with motivation
  44. 1 entries are tagged with moving
  45. 3 entries are tagged with music
  46. 1 entries are tagged with newserver
  47. 4 entries are tagged with node.js
  48. 1 entries are tagged with obama
  49. 1 entries are tagged with oil
  50. 1 entries are tagged with productivity
  51. 1 entries are tagged with radio
  52. 1 entries are tagged with rails
  53. 3 entries are tagged with recipe
  54. 1 entries are tagged with redmine
  55. 2 entries are tagged with reflections
  56. 1 entries are tagged with rmine
  57. 8 entries are tagged with ruby
  58. 1 entries are tagged with salmon
  59. 1 entries are tagged with salsa
  60. 1 entries are tagged with shoutcast
  61. 3 entries are tagged with site
  62. 2 entries are tagged with snow
  63. 1 entries are tagged with spill
  64. 1 entries are tagged with spotmanradio
  65. 1 entries are tagged with streamtranscoder
  66. 1 entries are tagged with summer
  67. 1 entries are tagged with tecate
  68. 1 entries are tagged with technology
  69. 1 entries are tagged with thanksgiving
  70. 1 entries are tagged with thoughts
  71. 6 entries are tagged with travel
  72. 1 entries are tagged with trip
  73. 1 entries are tagged with turkey
  74. 3 entries are tagged with twitter
  75. 1 entries are tagged with website
  76. 1 entries are tagged with wordsquared
  77. 4 entries are tagged with work
  78. 1 entries are tagged with x4200
  79. 3 entries are tagged with yz250
  80. 1 entries are tagged with zeromq

Twitter Updates

Links to check out

Subscribe RSS