How Clojure is to the JVM as Bash scripts are to Unix

I'm undoubtedly one of the brainwashed hordes that believe Clojure is the best thing ever to happen to the Java ecosystem. Possibly this is because I am a longtime Lisper glad to see my favourite language as the centre of attention once more, but I do believe that the JVM was an ecosystem in need of a great dynamic language, and for me nothing fits that description better than a modern dialect of Lisp. Unfortunately I can't join in with the Clojure cheerleaders who suggest that it can be a complete replacement for Java. For me Clojure is to the JVM what Bash scripts are to Unix; it is an excellent choice for tying together JVM libraries into a web application, but a dynamically typed language without natural support for OOP is no use for writing those fundamental units of code without which Clojure wouldn't be nearly as useful.

Whatever your opinion on OOP as a programming paradigm (mine is "unconvinced") it is the foundation of code reuse and sharing in the JVM ecosystem and Clojure lacks natural support for writing JVM objects. I am well aware of gen-class, but is not idiomatic in Clojure, Lisp or functional programming in general. As such gen-class doesn't make clojure Object Oriented any more than C++11's lambda's make C++ a functional programming language. Another facet of Clojure that makes it a poor choice for writing JVM classes in is its dynamic typing, once again you can circumvent this with type hints, a necessary evil that is hardly idiomatic.

So if Clojure is a poor choice for OOP, it is a poor choice for writing JVM components, and it can only be useful as a language for tying together these JVM components - which after all is what makes it perfect for Web Applications. This isn't a criticism of the language, it is just a comment on its place in the ecosystem. I don't blame Bash for being a poor choice of language to write a Web server in, and I don't blame Clojure for being restricted to solely high level tasks.

However this incompleteness potentially explains the comparatively slow uptake of Clojure in enterprise when compared to other JVM languages such as Groovy and Scala. Given the choice of training a workforce in one language suitable for almost all tasks or training them in multiple languages, the tech-unaware boss is always going to choose the cheap option - one language for all situations. After all that was the secret of Java's meteoric rise in the first place.

Posted on 26 September 2012

Based on a work at

Slide to code blog is licensed under a Creative Commons Attribution 3.0 Unported License