Node.js is the software that allows you to run Javascript to create powerful server-side applications by using Google's V8 Javascript Engine. As a Node developer myself, I have always felt frustrated by seeing that Joyent, the company behind Node.s, was extremely conservative in terms of upgrading node to use the latest V8 version; the project was also struggling to get developers to actually contribute to code. This is why Fedor Indutny did the unthinkable: forked node and created IO.js. Today, the two projects are uniting possibly offering developers the best of both worlds
(Score: 5, Informative) by deimios on Sunday June 21 2015, @11:59AM
I have a bit of experience with node.js and when it works it's the perfect fast prototyping platform for sites. Though coming from a JavaEE background I guess a dead turtle in superglue is faster at prototyping than JSF.
From my (arguably limited) point of view:
Pros:
You can get from 0 to functional webapp in minutes
The package manager is pretty good when it works, there are packages for almost everything
The async/ callback based coding style is interesting
Being JS based it works nicely with MongoDB and other JSON style NOSQL DBs
The community is HUGE and still growing
Extremely simple to configure some very complex stuff. Since you're on the same level as the webserver you can tweak pretty much anything.
Cons:
Singlethreading can mess up multiuser sites in interesting ways. Especially coupled with the "cluster" module which makes it multithreaded.
It's rapidly evolving, sometimes breaking modules or their dependencies. Lack of a "standard" way of doing things, since modules implement features first then the core catches up with an incompatible implementation.
Callback hell (it's so bad it has its own site: callbackhell.com)
Since you're working on the same level as the webserver you will need the boilerplate to actually fire up listeners on port 80 and all the other misc stuff.
(Score: 2) by fleg on Monday June 22 2015, @02:32AM
interesting, thanks.
i'm now wondering if node.js would be a good fit for something i may have to do.
i have a java command line which takes some images (3 or 4), does some processing on the images (takes upto 5minutes) and spits out a result image. at some point in the future we may want to put that command line behind/in a server and have people send the images they want and receive the result back.
i had been thinking i would have to go the route of ejbs and some sort of app server like say jboss (which i have used before), but it feels like overkill, so i'd been considering just writing a simple server which just sits on a socket waiting for requests. but now i'm thinking maybe node.js is worth investigating.
(Score: 2) by deimios on Monday June 22 2015, @04:05AM
If your image processing algorithm is non-blocking or can be rewritten to be non-blocking then go for it.
Just beware: node.js runs in a single thread so if you do any synchronous heavy processing, it will hang the main thread's event loop which will pretty much hang the whole stack. This means: no pages served, no logs written until the processing is done.
Take a look here: https://github.com/glenjamin/node-fib/blob/master/app.js [github.com] to see an example of node.js style heavy processing. It calculates the Fibonacci tree in a non-blocking way. (not my code)
(Score: 2) by fleg on Monday June 22 2015, @05:08AM
understood, thanks.