Общо показвания

октомври 03, 2011

Node madness

I may or main not know - I make living as javaScript developer. As such I invested time and energy even beyond my 8/5 work schedule - I often fund myself involved in on-line activities related to augmenting my skills in the language I support my family with.

This said, it is explicable that I as excited when nodejs came around. I was not exactly one of the first adopters and around he time I tried it there were connect and early form of express and other middle ware and frameworks that ease the server side development. And I was relieved! Because frankly who wants to reinvent the wheel.

Yeah, node promoted itself big time in the JavaScript community, promising you the ability to write your logic once and run it anywhere, the server and the client alike. There are even companies that struggled for almost two years to reveal a large scale product based on node (like nodejitsu and cloud9). Interesting and useful (mind you!) things came to life - Socket alternative (like commet for python) at your disposal that you can code for in the language you already know well, for example. I for one was struggling once with Comet!

This however must come to an end. Why? Well, the thing is node might be great for some subset of application cases, I for one have never had one of those however. Node still does not have great SQL linkage (unlike any other server side language you still cannot reliably use stored procedure in the SQL server and have reliable return values in your JavaScript, I my practice we had to modify the procedures to have only one SELECT to be able to parse the results correct in mysql-node.

And today I read this article that says it well : node js is cancer. Why? Because it is over praised and use for "everything", while its niche is in fact pretty small. The fact that get to use language on the server that you already know might be tempting, but the thing is - it is not necessarily appropriate for everything. And while you applications logic start requiring ultra dynamic server side + client side mix of JavaScript it will never be!  I mention that because there are good projects out there that allow you to call server side JavaScript objects and method and this sounds very tempting to me, as on the server I can rely heavily on standards (V8 for example) this is mostly not the case in browser environments. On the other side this is somewhat simplified work around for cases where server side calls are performed and executed in other languages - i.e. the client side does not need to care about the server side implementation, which IMO makes this somewhat pointless, unless you need to write the server side logic as well.

My disclaimer: I have release exactly one web project completed entirely in node.js environment. And to tell you the truth - very simple one. And I gave it all up. Why? Because this is simply bull shit! I had to re-create in JavaScript functionality that was build and ready to use for years in pretty much any other server side language. And on top of that I had to learn new tools for server side deployment, 'forever', node set-up, npm set up and other things just to get this one web site going. And mind you  - the idea and implementation there was easy! The most simple thing, sending emails, took me a day and a half to start working properly. Not because I don't know the language, just because out of the 8 implementations in npm only one was able to do what it is supposed to to - everything else made the main server dislike us. Try this in any other language, be it java, python or php or really anything server side and you will see - it will just work.

So you see, I am not against node.js. I am against using it as general purpose server implementation.

Yet another thing I have to confess: I use node applications to JSLint my client side code, I use jade executable to compile my client side templates and I use uglify JS to minify my code. I sometimes also use requirejs with node to minify and compile the client side code before deployment. But notice - those are only tools. I would never use those on server side application.

How I see the future? I think most useful it would be to just make node work as library on top of apache like the python interpreter is. And use it only where needed!
Публикуване на коментар