Re:Why use JavaScript rather than PHP on the server?
by drorweiss on Saturday May 11, 2013 @06:32AM
(#5690255)
While it's true that threads are ok if implemented correctly, one needs to be smart to correctly work with threads, and still any concurrent code will be ~10x more expensive to write and maintain.
In my perspective lack of threads is a blessing because it takes this complexity out of the equation.
On the other hand, working with async callbacks also takes training and more careful thought of the bindings and closures.
For me, after 6 months with node, I can say that I like it. It's superfast, ample modules to work with, and javascript is very convenient for working with data.
Re:Why use JavaScript rather than PHP on the server?
by thirsteh on Saturday May 11, 2013 @06:57AM
(#5690292)
Yeah, like I said, running single-threaded, e.g. in Python with the GIL, or in JavaScript, saves you having to worry about synchronization. But that should be the only big argument for it, not performance and scalability.
Re:Why use JavaScript rather than PHP on the server?
by techaddict009 on Saturday May 11, 2013 @04:12AM
(#5690072)
Said it true.
If you absolutely want to use JavaScript, then yes, you'll be writing event-driven code using a continuation passing style. JavaScript is probably one of the better languages for doing so, since the language is fundamentally single-threaded, and so virtually everything is asynchronous. The biggest argument for this is that you don't have to worry about synchronization. But please don't imply that event-driven programming is The One Way, or even the right way at all. If you want to scale, then you will eventually need to consider threading of some kind, whether it be the poor man's kind that Python and Node use, spawning multiple processes, or the good kind, fibers that automatically multiplex onto OS threads, as the Go and Haskell runtimes implement. Even the async poster-boy, nginx, does this via its workers.