A tour of the Clojure landscape

Clojure landscape

I am working on an automatically-generated, browseable directory of Clojure libraries. If I am viewing a library in such a directory, the directory should be able to give me a list of other libraries that I should consider instead, as well as a list of libraries that work well with this one. The directory application could infer such information automatically based on how often various libraries are used together on Github.

While I originally generated the map above as an intermediate step towards that goal, I also found the map itself interesting. There were a lot of projects that I hadn’t heard about, and those that I did know about tended to be close to eachother. Did I actually have a position on this map, so that I would only hear about nearby projects? With that in mind, here is a quick tour of Clojure’s landscape. Clojure’s community is growing fast, and it can be hard to keep up with all the projects. Hopefully I can introduce you to some interesting projects that you haven’t heard of before.

1 ) The capital city: Clojure and Clojure-contrib

This is where Rich Hickey and other Clojure/core members are hard at work on Clojure 1.3, including performance improvements such as primitive function arguments, primitive return values, and pods. Clojure/core also provides support, mentorship, training, and consulting services for companies that are adopting Clojure. You can learn more in Rich Hickey’s recent InfoQ interview. I just sent in my contributor’s agreement and am eager to join the effort.

2 ) Building Clojure projects: Leiningen

Leiningen is an easy-to-use alternative to Java’s Ant and Maven. It provides built-in commands for common tasks like downloading dependencies, compiling the project, creating a JAR file, and launching a REPL. Leiningen’s creator, Phil Hagelberg, has been remarkably effective at soliciting contributions, and a wide variety of community plugins provide additional Leiningen commands.

3 ) Dev Ops: Pallet and JClouds

Pallet is an alternative to shell scripts and manual server administration. It communicates with cloud providers tostart up new instances, configure those instances based on predefined recipes, and perform day-to-day tasks like deploying new versions of an application.

Behind the scenes, JClouds allows the same commands to work for a variety of cloud providers.

Some good introductions include Hugo Duncan’s article on shell scripting, and Chas Emerick’s article on continuous deployment of web applications.

4 ) Cake: a Leiningen rival

Cake competes with Leiningen as a Clojure build tool. It is compatible with most Leiningen project.clj files, and comes with extra features such as fast start-up, a dependency based task model that allows you to extend existing tasks, and an enhanced REPL with paren matching and tab completion.

5 ) Web development: Ring, Compojure, Enlive, Hiccup, and Sandbar

So far, Clojure’s web development options are based on small, easily-composable libraries. In other words, more like Sinatra than Rails. Ring provides an abstraction over web servers, as well as support for defining middleware. Compojure takes care of routing. You can generate HTML with Enlive if you prefer pure HTML templates, or with Hiccup if you prefer to write views directly in Clojure. Sandbar takes care of some of the remaining issues, like authentication/authorization and form validation.

Conjure is another option, which is closer to the Rails style.

6 ) Beginner’s projects: TryClojure, Clojure 101, Clojure Koans, and LabREPL

Each of these projects helps new Clojure programmers to learn the language. Try Clojure allows you to try out Clojure in your web browser, no download required, and even includes a small tutorial. Clojure 101 and these notes are training materials for an online course offered by RubyLearning. Clojure Koans is a test-driven approach to learning, in which you fix small code examples to make tests pass (based on a similar project for Ruby). LabREPL is part of the training materials for Clojure/core‘s Clojure training program.

7 ) Testing: Midje and Lazytest

Both Midje and Lazytest are alternatives to the clojure.test framework that is built in to Clojure. Midje encourages a separation between the actual tests and “checkers” that determine whether a test passed. Lazytest can be set up to watch your project’s files, and rerun the tests automatically whenever your source code changes.

8 ) Musical Clojure: Overtone

I was surprised and delighted to discover Clojure’s musical island, at the bottom of the map. Jeff Rose created Overtone as a replacement for a Serge Modular synthesizer that he enjoyed playing with, but that didn’t have a save button or other nice abstractions. He presented Overtone at a Rails conference (video).

9 ) Further into the frontier

Brian Carper’s Cow-Blog is so far out on the frontier that it doesn’t even show up on my map. This blog engine seems to be rather rough around the edges, but I’m considering migrating my own blog from WordPress to Cow-Blog. I like the idea of taking a peek under the hood and tinkering with the Clojure code. Plus, it looks like it comes with support for syntax highlighting of code examples.

I created the map above by tying projects together that share at least two contributors. Naturally, any single-contributor projects wouldn’t show up on such a map, and projects with only a few contributors also have low odds of showing up. Several startups have used Clojure for distributed computing, but projects like Cascalog(video), swarmiji, and clojure-hadoop aren’t on the map.

What other projects should be included in a tour of Clojure? Share your ideas by commenting below or on Hacker News.


Filed under Programming

12 responses to “A tour of the Clojure landscape

  1. Pingback: A tour of the Clojure landscape « Interesting Tech

  2. Off the top of my head: Incanter! and [ Lamina, Aleph, Gloss ] from Zach Tellman. Jim Duey’s stuff like Conduit. DB stuff like clutch (Couch), ClojureQL (sql), and others that I forget. crane for dev ops.

  3. Benny Tsai

    Two that I’ve been following closely: appengine-magic (making Clojure play nice with Google App Engine), and docjure (read & write Office docs from Clojure).

  4. K

    Which software did you use to generate the graph image?

  5. I wrote some Clojure code to pull data from Github and output a CSV matrix, in which each row is a project and each column is a programmer, indicating which programmers contributed to which projects. At that point, there were about 400 programmers and 200 projects. The code to do that is part of the browse-clojure project, which will eventually grow into the directory that I was talking about at the beginning of the article.

    A social network researcher, Chris McCarty, showed me how to import that data into UCINet, convert it to a 1-mode UCINet data set (projects connected to projects instead of programmers connected to projects), re-open that dataset in NetDraw, and size the projects according to betweenness centrality.

    If I wanted to create a version that updated automatically, so that you could watch the network change over time, I would replace the UCINet and NetDraw steps with JUNG, because I think it would be difficult to control graphical programs like UCINet and NetDraw from Clojure.

  6. Pingback: Top Posts — WordPress.com

  7. Thank you for this great article. This is very useful to a clojure beginner.

  8. Mac

    There is also VimClojure (clojure support for vi), clojuresque (clojure plugin for gradle).

    and work by Bradford Cross https://github.com/getwoven/work
    also clj-http https://github.com/getwoven/clj-http, which I found to be the best http client lib for clojure.

  9. Nicolas

    For the web developpement i tend to disagree with the choice of templating engines.

    I know that at first it look fun tu have our own DSL to generate HTML. But hey HTML is the DSL. Using clojure arrays and keyword to represent HTML is only usefull for parsing or transforming HTML, not to render it.

    The most common task on a web server is to render HTML, not to apply functions on it, at least on the server side (where seat clojure).

    If you use a more classical templating engine, you can allow your designer to use it, and… HTML look like HTML. This is a real strong feature. If you think of it, it is common to use Java object for XML document (JAXB…) because it is common to make transformation on XML or to parse XML. This could be possible for HTML too. But most framework uses plain HTML with a special syntax to inject code/data. This is not by accident. This is because, the most usefull feature is to see HTML… As HTML.

    So, i am looking for more classical templating frameworks and I’am looking forward some experiements :
    – you can use Fleet, a classical template framework that can mix standard HTML and clojure code.

    – I guess you can use JSP. I haven’t tryed that, but the strong point is that everybody in java community know JSP and that I guess with common beanUtils you can make JSP think that clojure maps are in fact JavaBeans.

    But the most promising solution that I know of is to use google Closure Templates. It can work with any java map, so with clojure maps too. And it have a truly killer feature. The same template can be used for the server and the client.

    What the interest of that would you say ? You can see some interresting tutorial for JQuery template so you see what template on client side can do. Pretty cool uh ?

    Then imagine using the same template on both server and client side :

    You application display a list of TODO tasks. You can render it on server side using your template. You have a main template for the page, and a sub template for one Todo that you apply for each row to display.

    The user request the web page, you process the template on server and send the HTML.

    On the browser, the client click on “add todo” button. This create a new todo task as a native javascript object. You use the same template on client side to render this new todo. No need to hack the dom, no complex code. One line call to the template engine and it is done. The user modify a task ? Well either you change the DOM elements using their ID, or you simply render again the row using the updated JSON object. Yes it is that simple !

    And because Closure Template are compiled on server side to native javascript, they are really fast.

    Hey you added a task and modified another one and didn’t even make an HTTP call ! No server load, no network latency. Your app is insanely fast interreactive and responsive. And to do that you coded nearly nothing.

  10. Pingback: Information Overload 2011-02-06 « citizen428.blog()

  11. Pingback: Clojure: Links, News And Resources (11) | Angel "Java" Lopez on Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s