Hacker News new | ask | show | jobs
by eik3_de 4467 days ago
Curious: Why do people choose JavaScript/node.js to write command line apps over traditional languages for that task like python or ruby?
5 comments

I can answer this for Keybase: first off, it's not because we can't learn other languages (someone suggested that below). In fact, we spent 10 years programming OkCupid in C++, and we've built some high performance projects in Go. It's hard to imagine someone could program anything even remotely like Keybase and lack the programming skills to do it in a variety of languages.

Anyway, in our case we (1) like the async programming model, and actively use it -- on the server side, our services tend to be modular and actually speak over RPC layers to each other, not just one big ugly web process. Node is great at this.

And (2) in this case, because we wanted to have a lot of shared code among our first implementation of a client, our browser front end, and our server. It worked very well to work on all three with one language. It's worked out.

I personally miss compiling C++. :-)

There's a very good chance we'll end up writing a Go client for Keybase. We might switch the official reference client once the functionality is more locked down.

Lastly: it's really CoffeeScript, not JavaScript. Which is a different can of worms to open on here.

Why do people choose python or ruby to write command line apps over traditional languages like BASH, PERL, and C?
The primary argument against node.js (and perhaps ruby) AFAIC is that many users will not already have it installed. Python/Perl/Bash you can count on all users having. C is a fine choice, but of course requires more packaging to be user friendly.

I've used zsh as my interactive shell for years, but I always still write bash scripts instead of zsh scripts. You can count on bash scripts running just about anywhere.

Exactly - I read:

"Why do people choose JavaScript/node.js to write command line apps over traditional languages for that task like python or ruby?"

and was agreeing with the first part of the sentence and then laughed out loud at the end ...

Are we really in a world where ruby is the old school traditionalist way to write unix utilities ?

I was working with Capistrano almost a decade ago when it was called SwitchTower, so yeah -- it is kind of old school considering most "startup" developers are under 30.
Because they don't know BASH or Perl and writing a Ruby/Python script is more often than not faster and easier than doing the equivalent in C?
Because they already know JavaScript.
npm is a fantastic package manager that integrates very well with github, and node -- in the opinion of a lot of people -- has a rather intuitive system for installing and loading third party modules.

EDIT: also wanted to add that node exposes your standard POSIX-style interfaces to the OS, so there's really no reason it can't be a general purpose replacement for other languages for writing system tools.

"no reason it can't be a general purpose replacement for other languages for writing system tools."

Perl/Python come installed by default in the majority of distros (and Mac OSX)

They're also more mature at this stage

So, yeah, node may one day be as supported as them, but today it is at a disadvantage.

cause they cant learn anything else.