Saturday, January 18, 2014

Clojure/Compojure/Ring , a new experience in developing web applications


Its been more than 10 years working on java based applications mostly web applications mostly using a range of frameworks from pure servlets to spring web flow. Except in case of a Servlet you definitely feel that there is this heavy stuff that is surrounding your code.

Although I have liked the convention based approach of Ruby on Rails and Grails on JVM  the introduction to Clojure web development with Compojure was an amzing experience and I had my doubts too.

A Simple Log View application I planned to develop for my work place sounded perfect for me to put it to test. Here are my observations

Good

  1. Super Simple way to test the functionality using fine grained functions at REPL
  2. Ability to attach to a running application using nREPL giving me never before speed of development. Being there in the application always is an awesome feeling, somewhat similar to SmallTalk environment
  3. Intellij Idea with Cursive Plugin is an amazing one for me, considering my java background and long standing incompetence in mastering EMacs.
  4. Enlive as the template transformation/generation tool is something i wanted for Java all the tim
  5. Lein is the best project build/dependency tool  I have ever used (I still love Gradle for java though)


Bad (or Ignorance)
  1. Not very sure about the idiomatic way to manage state in a web application. In Java world I was used to store values in session without even thinking
  2. SQL Korma like libraries provide great way to access database using a consistent API but  there is no easy way to handle transaction roll backs in case of a Optimistic Lock Exception like the way I was used to in Hibernate/JPA world using the version field and checking update counts.