I didn't say it was just for minor workflow events, I said it was created for minor workflow events - it's just good fortune that Brendan Eich was an experienced language designer and created something that was powerful and extendable enough to bring us to the situation Javascript is in today.
It's certainly powerful (particularly considering it's original intentions), I disagree that it's expressive in comparison to other modern languages.
Why anyone thinks server-side javascript is a good idea is beyond me.
That someone would want to use the same language to write both their client and server side code is beyond you?
Perhaps you believe that in web applications, all of the real computation happens on the server, and JavaScript is just for providing a nice UI. Some people probably want it to be this way, so they can do most of the work in their preferred language and runtime environment, and only deal with JS for the minimum of client-side work. But to take this approach is to leave unused the embarrassment of riches that we have in computing power on the client side, even in smartphones. If we make full use of that client-side computing power, we can reduce server resource consumption and, more important from a user's perspective, the need to incur the cost of network round trips.
Or maybe you think that in modern web applications, most of the complex logic belongs on the client side, and the server is mainly for receiving, storing, and sending data. In that case, perhaps you think the most important attribute of a server-side language is performance. But it's probably quite rare for the server side of a real web application to be a dumb data store. So what happens if you wrote some non-trivial logic in JS, then discover that it needs to run server-side?
I think we're still figuring out what belongs on the client and what belongs on the server. Therefore, I think using the same language on both sides might have some benefit. Admittedly, I've never written a real application with Node.js, and the thought of callback spaghetti everywhere doesn't exactly appeal to me. But I might accept that in return for maximal code re-use.
I think this article says it quite well: Callback Hell is a Design Choice : http://blog.caplin.com/2013/03/13/callback-hell-is-a-design-...
Where are these mythical Node.js applications that share so much code with the client though? What functionality is shared and how much time did it save anyone?
Personally, I wouldn't trust one browser-land function or library in my server application without digging through every line of code to make sure it's not going to do some browser-specific hackery. Then what have I saved? I'd rather go get a separate module that was built specifically for Node.js.
Then there's the time I'd save sharing my own code between Node.js and browser - which would be next to nothing because any time I save would be spent having to think about platform differences anyway.
I suppose you know what's appropriate.
Why would a person of that opinion value a small amount of code sharing over language expressiveness? So, there's your answer as to what they're imagining.
Regarding code sharing - maybe you can answer another post in this thread which I ask, "Where are these mythical Node.js applications that share so much code with the client...?"
My feelings towards js are are informed by that experience, and my (happier) experiences with other languages - which are primarily Python, Java and Objective-C, if you're interested.
You have objects on the client that you want to persist to the server but you don't want to have to write two models.
After coding JS by hand for years (while doing other languages) I'm done with it. I'm ready to go preprocessor full time, either static language based but also interested in lisp variants, because if I have to go typeless, might as well do it in style.
I tried CoffeeScript for a while, but the philosophy is too similar to JS to keep my interest. It did reduce the code dramatically though, on avg about 70%.
Not really. We do the strict conventions thing and have had a lot of success with it. Being able to run in a browser is a huge, huge advantage. If I had a nice statically typed language that gave me that advantage as well as javascript does, I'd probably switch to it, because by inclination I prefer the compiler to do more work for me, but there's no way I want to leave behind having my code work for anything with a browser and f5 to see my code in action.
A lot of web applications routinely do many I/O operations per request handler. For example, do a DB query, then do something with that data, then conditionally do another DB query based on the results of the first, then do something with that data, then query a REST Web service, and so on. Blocking APIs make this very natural; add high-level abstractions such as an ORM, and you don't even think about the fact that you're doing I/O. With something like Node, application code of this sort degenerates into callback spaghetti, unless you use something like the fiber module, or a compiler that transforms the natural, straight-line code into continuation passing style. Though I've previously argued for the potential advantages of using the same language for both the client and the server, I fail to understand why something like the fiber module isn't standard in Node, or why the kind of compiler I described isn't more popular. Perhaps that's just dogmatism or a cargo-cult mentality.
An event-driven system might be good for "real-time" applications where many clients connect and wait to have things pushed to them. Even then, I think coroutines or lightweight threads would be fine, as long as they're the norm for a runtime environment and its standard library (e.g. Go, and Haskell IIUC) and not bolted on (e.g. Python's eventlet and gevent).
Node can easily degenerate into callback spaghetti, that's true. But I think that has more to do with the paradigm being new to a lot of developers. Using promises and similar constructs are a very natural way to deal with callbacks, and reduce the spaghetti significantly. Unfortunately, they won't be baked into Node's core.
Even for a standard CRUD app, you can get way more performance out of Node than you can out of, say, Rails, precisely because it is highly concurrent.
I remember those times when Javascript was only used for changing button images in the mouse over event! It was a powerful extra to designers to have this knowledge.
The fact that Node.js is becoming popular is simply a symptom of having a ridiculously large ecosystem of developers, and not much else.
Yup, developers do. But clients and users don't. Just make it work!
The fact that Node.js, Javascript on the server, is gaining so much popularity in the developer community means that it has benefits beyond its universality in the browser.
Asm.js is not a "hack on the top of the mess", it's a simplification of "the mess" down to it's simplest, most bytecode-esque parts. And it's performance is shockingly close to Native.
Javascript is not the perfect bytecode for the web. But it does work as a bytecode for the web, and with asm.js, it seems that it works decently well. I think efforts are better spent improving Javascript, asm.js, and languages that can target it rather than swimming upstream.