37 minutes ago, RivieraKid said:
3) Most languages have an asynchronous method for I/O. For a long time you couldn't do any significant processing in the front end because it would freeze the browser. You could ONLY response to events. It is still very painful to deal with a large volume of visual elements.
I challenge you to find an asynchronous I/O C++ 11 API (or Java) that's as friendly as JavaScript's implementations. And while javascript uses multi-threading to do the actual I/O under the hood, the fact that all the processing happens on a single blocking thread makes it much easier to program (and slightly slower). With C++ and Java you would have to worry about synchronisation and deadlocks when doing multi-threaded asynchronous I/O. True, you could implement a single threaded message loop or a selector, but that's much more complicated to write and maintain. However, in Javascript, if you ever wanted to have mutlithreaded message*processing* you would have to work much harder than with C or Java.
That's why javascript is more beginner friendly. It takes the most common case ( that only the actual I/O takes time, and that processing is negligible), and gives you that out of the box. Requiring you to allocate new processing buffers for each request on the heap in the process.
That's why C is for more advanced use cases: You'd work 50 times as hard writing the code, but you can process requests in place on multiple threads.
And that's why Java is interesting: Because even though you'd still work 40 times as hard, you're huge code would be more maintainable if was part of a big project. (and it would run 50% as fast as C)
So if you're writing a small server side app with short bindings for javascript GUI code, use Node.js.
If you're writing a huge banking app, use Java.
If you need the extra performance because you are writing an HTTPS gateway (like NGINX) use C.
If you try to write the banking app in C or Javascript, you are probably doing it wrong.
IF you write the massively loaded HTTPS gateway in javascript you are probably also doing it wrong...
I'm using the webapps as an example. Because with games, your choice of language usually just stems from the toolset you want to use: ( Unity = C# , Unreal = C++ , Browser=Javascript, Android = Java + C (NDK) , iPhone = ObjC, etc...)