Home »

Clojure Cup 2014

During the last weekend the Clojure Cup tournament took place and Alonso, Juan and I participated. In Kaleidos there are some Clojure enthusiasts that are investigating the language and the ecosystem, and some of us are even writing libraries already.

We have an internal joke with the days that have passed without someone “breaking the git repository” or “spilling his beverage”, and there are even some brave people that count the streak of “public GitHub contributions” and want to at least commit publicly once a day. We thought that it’d be great to be able to track these counters in a webapp and we wanted to see how it looked like in our office TV so we proposed a project called “The Final Count App”.

Day 1 – Saturday

Alonso and I started the day with a delicious breakfast at the office while Juan was at home crafting a beautiful design. We then kickstarted the git repo, setup a deploy script with Fabric and organized the tasks for the weekend. After this the designs were almost ready and we scattered to continue to work remotely.

Since we didn’t have a lot of time to adapt the designs to CSS Alonso opted for rendering directly to SVG, which proved to be a great decision later on. We used the React-based Reagent ClojureScript library, which we found more straightforward and intuitive than alternatives like Om and powerful enough for our use case.

I spent the day organizing the backend code with the Component library and working on a HTTP API that could be consumed from the client.

We thought about using a PostgresSQL database but durability wasn’t a priority so we started saving everything data into a Clojure atom data type.

Late at night Alonso finally achieved to integrate the UI with the server API so we had our first version that actually did things 🙂

Day 2 – Sunday

We had a number of features we wanted to implement and very short time so we chose the coolest: “real time” notifications through websockets. During the day Alonso integrated the counter creation page and the integration with the API was complete. It was a nice unexpected surprise to see how Reagent mode made almost trivial the “preview” of the counters because the form and preview shared their state.

I used the excellent Sente library for implementing a pub-sub mechanism through websockets, now it was possible for clients to subscribe to notifications.

At 17:30 Alonso and I were back at the office after an exhausting weekend. It took a few minutes for Alonso to integrate the websocket notifications on the client and, after polishing a few things here and there, we deployed our app and went for a beer.

Conclusions

Alejandro: I really enjoyed working with Clojure again, even in a small project like this. I liked the way of managing systems with various moving parts that Component brings (it’s just dependency injection and managed lifecycles), the declarative way of building HTTP applications that Liberator brings and the robustness and great API of Sente. These libraries take a very interesting approach and they are quite mature.

Alonso: For me the hackathon format is a very nice way to try new things. Seems counter-intuitive (because you have very little time) but the “time-boxed” format makes you give your best and you start to finish things which is my main problem with my pet-projects… I don’t finish them! Clojure has a very nice ecosystem and some amazing tools. Furthermore, the community is thriving with new great ideas that you can’t see anywhere else. So for me, it was a great experience that I look forward to repeating next year.

Future

We’d like to continue the development of “The Final Count App” since it’s still lacking lots of features:

  • Group creation and privacy control
  • Counter detail page with its corresponding permalink
  • Several types of visualizations for counter groups
  • … and the list goes on.

It was a lot of fun and I hope more of us will participate in the next edition.

Happy hacking!