Limelight Lives - Clojure Toolchain of Choice

Limelight Lives - Clojure Toolchain of Choice

Micah Martin

July 19, 2013

I want to tell you about my Clojure toolchain of choice, but in order to do it right we need to go back; way back.

The year is 2008. I'd been working intensely on Ruby on Rails apps for a couple years. As such, I had become intimate with many aspects of web development that frustrated me, a lot. I was so bothered that I gave talks on the subject at Ruby conferences: (10 Things I Hate about Web Apps). And I endeavored to create the perfect development platform; an alternative to web apps: Limelight.

Limelight was my dream: a reprieve from the torments of web development. Limelight was pure. Limelight was elegant. Limelight was NOT realistic! I mean, Who was I kidding? Limelight was competing with the World Wide Web. Limelight was lost from the beginning and is now, for the most part, dead.

Today, five years later, much has changed. The web is rich. Browsers can do things we only dreamed of before. New languages, new technologies, and new tools exist that empower developers. As I build web apps today, I feel as though I'm working in the Limelight I dreamed of five years ago...... almost. Allow me to tell you how.

Clojure

For most readers, it'll come as no surprise that I like Clojure. I find it to be superior to Ruby, which was my favorite language for years. In fact, Limelight had been modified to support Clojure too. Clojure lies at the core of my development stack.

Leiningen

Leiningen is the de facto build tool for Clojure. It pretty much rocks. And shout-out to REPL-y for rockin' the repl.

Speclj

Testing: I am devout to this development discipline. Speclj is a tool I crafted to help me test. It is simple and effective. I use it in all facets of development.

Joodo

Joodo is a Clojure library for web development. It has radically evolved with the rest of the Clojure ecosystem. Today it is a mere shell for other great libraries. They include:

  1. Ring: Ring is a true gem: an extrememly elegant abstraction around HTTP. Ring enables you to build and customize your middleware with such ease, you can feel the power at your fingertips.

  2. Compojure: Compojure is a routing library. It maps incoming requests to functions. It also provides some handy destructuring of requests.

  3. Hiccup: Love the name. Hiccup is a DSL for generating HTML/XML. The beauty of it is that the syntax is valid Clojure code! That fact alone is worth its weight in gold. Uh-huh, that's right.

Hyperion

Okay, The jury is still out on Hyperion but its premise is inspired. It's a persistence layer that has implementations for many of the big databases. (I like to use MongoDB.) Hyperion provides a simple and consistent API that works on all platforms. All models are maps (hash/hashmap/dictionary), and you'll only need to use three or four API functions in most cases.

On multiple occasions I've moved apps from one database, say Google AppEngine's Datastore, to MongoDB without touching the code. And the tests run in memory, FAST!

The downside? In order for Hyperion to maintain its simple API, it can't support many of the features that databases provide. Don't expect to use any joins or mapreduce with Hyperion. But how often do you REALLY need those in the core application logic? I've got several live apps that have been using Hyperion for years without a hitch.

ClojureScript

JavaScript is one of the best and worst things that has happened to the software industry. ClojureScript allows me to enjoy the "best" and avoid most of the "worst" of JavaScript. Most importantly, it means I'm still writing Clojure code. (This "one language" theme is pretty important to me.)

Specljs is a release of Speclj that runs in ClojureScript. I only need to know one testing framework... Yeah!

Also important here is cljsbuild, a Leiningen plugin to help with ClojureScript. While cljsbuild can be a bit awkward at times, its auto compile feature saves SO much time.

Notable Mentions

  • Metis is a general purpose validation library. Quite handy.
  • Domina is your right hand when working with the DOM in ClojureScript.
  • Shoreleave, a set of libraries, provides AJAX support.

Limelight Lives you say?

In many ways, using the above toolchain is reminiscent of Limelight.

  1. One Language. This was a core tenet of Limelight. If you look at the tools above, they all use the same language: Clojure.
  2. Rich. Back in 2008 you needed Flash, or ActiveX, or some other craziness to build rich webapps. Now we can do it in modern browsers with standard web languages. The tools above, particularly the ClojureScript ones, make it easier than ever to build rich web apps.
  3. Testable. All these tools are relatively simple pieces that could stand alone, but also work well together. Each one is easy to work with and easy to understand. That means that everything is easy to test. Even the client side code! It's a breath of fresh air. Ahhhhh.

So although Limelight may be dead, its spirit lives on, and I've captured it in the chain of tools mentioned here.