This is

as days pass by, by Stuart Langridge

. Here I write about many things. In the past I wrote about other things but the past is past. I write code for people to play with, I write about my life on Twitter, and I write here.

On I wrote Why node?, on the subject of CouchDB and Rants.

It's a loss to me why everyone loves node.js.

I mean, today janl blogged about some magic thing where you can feed the output of a CouchDB query to a node.js script and output the id of all the documents retrieved.

Why you wouldn't do this as

curl http://localhost:5984/_users/_all_docs|python -c "import json,sys;print [x['id'] for x in json.load(sys.stdin)['rows']]"

escapes me. I mean, node.js is clever enough for what it does. Next time I need to build a project which only needs what node can do, I seriously plan to use it; it's a very neat limited thing. Good work, node people.

Until I need to build that limited project, I'll stick with Python.

Maybe I should move to the Valley and buy some Oakley sunglasses and a Macbook and then I'll get it.

Simon

I think it's a matter of taste as much as anything. I'm a long-time Python fan myself, but been looking at Node recently. I think I prefer Python for most purposes, but there are cases where Javascript really excels.

Specifically, it's the best language I can think of for any problem that suits an asynchronous style of programming, since passing anonymous functions really works beautifully for callback handling. That's what Node is designed for, afterall. I certainly wouldn't use it for general-purpose scripting like this example...

Jeff Waugh

Don't compare node with Python, compare it with Twisted.

(Yeah, sure, node is very quickly becoming the most popular way to run JavaScript outside the browser, on the command line, etc. much like you'd do with the CPython executable, but that's not the #1 'why' of node.)

JavaScript suits evented programming very well. It feels native to the language, because in its historical context, it is. node blends that into network programming, ala Twisted, very well. Yes, it's terrifyingly fresh, and doesn't quite have the maturity of implementation or ecosystem that Twisted has, but that's changing almost hour by hour.

I'm using node for things that would otherwise suit Twisted, but without the "Python isn't built for this" speed bumps.

Jeff Waugh

That said, node's current niche is the beach head from which JavaScript will storm into the mainstream of non-browser-based development. There doesn't need to be a black and white battle of supremacy or zero sum game between Python and JavaScript for node and JS to enjoy success.

tf

'node.js is clever enough for what it does ... it's a very neat limited thing'

Sorry, but that just betrays that you did not really look at node, what it is for, and what it actually can do.

Simon

@Jeff, yeah, that's a good comparison. Python is *not* well suited to async programming - Twisted is a pretty good framework, but the Javascript style of passing anonymous functions as callbacks is much, much easier.

@Stuart - Re-reading your post again, it does seem that you've greatly misunderstood what Node actually is. It's not a general-purpose scripting tool - it's a framework primarily designed for building scalable network services. If people are using it for parsing strings from stdin, well, it works for that, but it's not really what it's designed for...

sil

Simon: indeed. That's what annoyed me about the post to which I was responding. Node is good at network services; JavaScript's a good language (always been one of my favourites; I've written books about it, fergawdsake), but the recent breathless desire to use node.js for everything because it's the New Cool Tool gets up my nose a bit. Exactly as you say, why would you use it to parse strings from stdin?

Alexander Jones

Blah blah blah Python is not suited for asynchronous programming. Call me ignorant, but passing around stacks of anonymous functions is not my idea of suitability. PEP 342 on the other hand...

http://www.python.org/dev/peps/pep-0342/

Great success.

tuna

[removed as spam]

tuna

[removed as spam]

Bingo Jack

[removed as spam]

Casino online winners

[removed as spam]

abbie

[removed as spam]

coach online

[removed as spam]

coach online

[removed as spam]

coach online

[removed as spam]

diego242

[removed as spam]

shoes

[removed as spam]

shoes for sale

[removed as spam]

discounttiffany

[removed as spam]

discounttiffany

[removed as spam]

discounttiffanysale

[removed as spam]

nikefree

[removed as spam]

discounttiffany

[removed as spam]

tradefootwear

[removed as spam]

Bruce Wells

[removed as spam]

This website belongs to Stuart Langridge. Contact details are available. Don't eat yellow snow. Valid HTML5, at least in theory, except for the bits that aren't because I'm that futuristic that I'm ahead of the spec, oh yes. HTML5 help from Bruce Lawson, among others. Fonts from the superb FontSquirrel. End.