Hacker News new | ask | show | jobs
by impostervt 5000 days ago
When I read about Node.js, the first selling point people mention is how you can reuse code on the client and server sides. For me, the main selling point is that it's Javascript. When I see new variants of js, developed to "fix" js, it makes me want to cry.
2 comments

I think there's a difference between languages designed to compile down to JS (e.g. CoffeeScript) and wanting to convert a completely different language (e.g. Ruby or C#) into JS.

JavaScript has a lot of good and bad parts, and given we don't really have an option of choosing to use something else in its place I strongly believe that (some) languages that compile to JS have their place. While I don't believe all of them are useful (i.e. dart, typescript) they're specifically targetted as an alternative to JavaScript.

If you're trying to convert a different programming language, that isn't based around the way JavaScript does things then I firmly believe you're doing something wrong. JavaScript isn't just remembering that the semi-colon is optional and that JSON is wonderful. While other languages support event driven behaviour, JavaScripts implementation is (probably) different meaning there's still a learning curve. The documentation for Node.js is, unsurprisingly in JS. The libraries are JS. The whole ecosystem is JS. At least with CoffeeScript quite a few libraries have their source as .coffee, and the style of programming is identical to the compiled JS.

Currently, reusing code on client and server is far from the first selling point. Companies like Meteor and Groupon are pushing in that direction quite heavily, but for mere mortals it's still limited to reusing a few core libraries like underscore, async or templating.

Reusing experience and knowledge, and reducing the cost of context switching, those are very clear and positive advantages.

On the topic of sharing code, these should be interesting: the 'pipe dream' ( http://keithnorm.com/spainjs-pipedream/ ) and the 'holy grail' ( http://thatconf.chrisjpowers.com/ ).

Thanks for the "pipe dream" link, I found the conference talk on youtube and enjoyed it a lot. The reusable code 'function' of node is still too non-obvious to achieve without the right mix of tools and this talk gave a nice intro for a solution.