r/programming • • Oct 03 '11

Node.js Cures Cancer

http://blog.brianbeck.com/post/node-js-cures-cancer
390 Upvotes

329 comments sorted by

View all comments

Show parent comments

8

u/cosmo7 Oct 03 '11

But you wouldn't have to do this on other platforms because you're already in a server thread.

0

u/headzoo Oct 03 '11

Multithreaded servers have their own pitfalls. In my opinion (And this is just me) writing a multithreaded anything introduces a number of complications, and is more difficult than writing asynchronous code.

9

u/cosmo7 Oct 03 '11

(I think you mean synchronous code. It's threaded processes that run asynchronously.)

You're actually arguing against using Node.js-style platforms; multithreaded servers might well be hard to write, but you don't have to write them.

2

u/[deleted] Oct 03 '11

... for certain types of program. IMHO, if you ever have users interacting with each other in any way, or your problem is IO-bound, or it's CPU-bound but just loops over an array and applies the same computation to each element in said array (async.js makes this easier under node.js), async is much, much easier, and actually easier on the processor as well (in theory). In other cases, multithreaded may be a better choice... but the vast majority of stuff on the web falls into the former section, as it mostly amounts to "contact an external database for data, quickly format, display".

For the record, I don't use node.js myself. I use a tiny, custom web framework written in Python 3, that uses a simple, asynchronous MVC-like pattern.