Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You lose expressiveness, you lose maintainability, you lose peace of mind, and you get speed.

- I don't think my JS/CoffeeScript code is (significantly) less or more expressive and maintainable than the Python code I would have written. Use coffee if you want a whole bunch of language features, including some missing in Python. Oh, and a much cleaner way to write lambdas.

- Yes you need to understand async. It is of course, increasingly relevant with services and devices talking to each other. For example, in Microsoft's WinRT anything taking more than 50ms has to be async by design. After a while you might even wonder why async isn't the default way of doing most I/O.

- Flow control is hard in async, especially when you are getting started. But there are libraries which help, such as https://github.com/caolan/async.

- The library approach works for me and is a safer bet, but isn't the cleanest. If you are adventurous you could try iced-coffeescript, which introduces keywords to give you simpler code.

- Finally, you need to have a really good grip on JS.



> I don't think my JS/CoffeeScript code is (significantly) less or more expressive and maintainable than the Python code I would have written

The loss does not come from JS or coffeescript, it comes from everything being done with callback (whether nested or not).


Those wanting to succeed with node.js should listen more closely to the parent post. IcedCoffeeScript promises, "Say goodbye to callback pyramids; say adios to massive code rewrites when synchronization requirements change slightly. Say hello to clean, readable, maintainable control flow for network and asynchronous operations!" (http://maxtaco.github.com/coffee-script/)

Personally though, I haven't yet tried/loadtested it, so can't speak to its effectiveness.

In any case, simply using plain CoffeeScript + async + underscore, will greatly cut down on node.js's complexity. Sure, you still have some async callbacks when doing I/O like calling some service, but it's much less awful.

(I haven't yet evaluated ClojureScript.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: