

Writing Node.js modules in ClojureScript - mstump
http://blog.sourceninja.com/writing-node-js-modules-in-clojurescript/

======
edoloughlin
I have to ask: why? It's server-side, so why not just write Clojure and take
advantage of the JVM performance, scalability and everything Clojure gives you
that just isn't available in ClojureScript?

~~~
mstump
In our instance we were publishing tools for Node.js, so that's why we did it.
Id'e rather write code in Clojure than JS or coffee script.

~~~
bascule
Would you rather write ClojureScript or real Clojure though?

~~~
mstump
Real Clojure. You have access to more of the language, better tools, more
libraries, better performance. Anytime you target JS it's like running with
lead weights around your ankles.

I think the argument for Node.js was that it is typically difficult to write
asynchronous code, and they made some effort to make that better, and the one
language across front end and back.

With Clojure you can write asynchronous code just as easily with much better
performance. I can also share code bases across my backend (cascalog, storm),
mid-stack (noir), and front-end ClojureScript.

The arguments against Clojure is that some people have difficulty learning it
and functional programming in general.

~~~
sgrove
This is totally awesome, thank you for writing this Matt.

That said, my argument against Clojure is the sheer weight Java interop
demands (I always found myself dealing with _far_ more Java than I would have
liked). And with Clojurescript, the tooling feels incredibly raw to me.
Getting started sucked up most of a weekend, and even then it was considerably
less pleasant than parenscript.

That said, clojurescript really just felt very young to me, and could become
something amazing with time and momentum. Perhaps you could write a short
article about your setup (backend-mid-frontend), and some tips for people
testing the waters? Would be highly appreciated!

~~~
mstump
Yeah I can do that, I'll add that to the queue.

The high level is Rails on the very front for legacy reasons, and it's easier
to find libraries that do, authentication, authorization, billing etc... that
speaks to solr or a restful service running on noir hosted by tomcat,
cassandra is the main DB. All backend tasks are performed by Hadoop or storm,
and those jobs are all written in Clojure.

To be honest I feel that the Java interop isn't that bad. It's easier than
doing interop from ruby/python down to C or C++. It provides access to lots of
high quality libraries and you get the JVM. I think it's more than worth the
price.

Although I know many functional programming languages, Clojure is the first
that I've stuck with long term, and I think the strength of the ecosystem has
a lot to do with it. Languages like Erlang, Haskel, and lisp are really
interesting, but the breadth and depth of the libraries isn't comprable. Being
a small company we need to be careful how we allocate resources. We contribute
back where we can, for instance we contribute to clj-hector and
cassandra.cascading but we're only a two man dev shop.

------
mstump
Hey, just published my after action report on publishing my first Node.js
module written in ClojureScript. I was trying to fill some gaps in the
existing documentation and pool together the research I did for the project.
Hopefully some people here will find it useful. I would appreciate any
feedback pro or con. Thanks!

------
robkwok
thank you

------
moorage
hardcore!!

