Clojure’s web stack
Disclaimer: This is by no means an exhaustive list nor should it be taken as one. This is what I chose, with a few brief reasons as to why.
Like most languages still trying to find its legs, Clojure web stacks are plentiful. Beyond the basics of Tomcat vs. JBoss (and others) you have to ask yourself should I go with Ring? What about Compojure? Maybe I want to try something more advanced an rails-like? There’s a lot to consider, and few clear winners. I’m going to declare a few here, but this is my own opinion and not necessarily the opinion of the Clojure using masses.
Before I get started naming winners I want to point out that the Clojure community is very young indeed. The language itself was written by Rick Hickey and made its first appearance in 2007 after almost three years of development. Five years is not a long time for a new language, particularly a lisp-style functional language, to build communities and toolsets.
That doesn’t mean the communtiy hasn’t been hard at work though. So let’s go bottom up.
Winner: Korma (with caveats)
Well, this one is a little bit complicated. From a rails perspective there’s not a lot of difference between what Korma provides us and what Arel does, they’re both essentially DSLs meant to eliminate the writing of manual sql and make our queries database neutral. It’s not technically an ORM but for the sake of translation, I’m going to go ahead and call it one.
Korma translates a simple query syntax into sql depending on the database type given on the connection. It understands Oracle, SqlServer and a variety of other database solutions including all of the standard open source solutions. The structures it returns are readable in Clojure as key/value pairs.
Now for the caveat. Korma is a beta product. At the time of writing this the current version is 0.3.0-beta7. There are some bugs, as with any software, but because it is beta they can be more severe than what you’re used to. To me, that isn’t an issue. I hope to find the time to actually help this project grow and mature, but for others this might be something to watch out for.
Okay, so this one has a chance to be pretty controversial. Like any early-language framework wars (and even some form more mature languages) there are strong feelings on both sides of the fence.
I’ll keep this short though, I chose Noir because it provides me that middle ground between the more rails like Conjure and the lighter-weight Moustache, and I think it’s a happy medium. Noir uses Ring, Compojure and Hiccup to manage everything a web framework should have, while Leiningen manages Noir. All in all it is a complete system that I feel remains ahead of its competitors.
I’m an Apache guy, I believe in the mission and the simplicity they bring to it. Even though I’ve never been a big lover of Java (and I love Oracle even less) I can’t argue with results. Apache Tomcat provides simplicity and minimalism to make it my choice for Java servers when I need them. Because Clojure is JVM based, you’ll need it.
One Ring To Rule Them All:
Much like we use RubyGems to manage everything in the ruby world Leiningen does a great job of wrapping up dependency management, plugin management and the exposure of commands. While you could, technically, do Clojure without Leiningen you’d be sacrificing a lot of great things, including easier deployments.