Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'rich' web apps with Clojure

I am having a bit of a struggle while building a Clojure based web application. It's a simple CRUD app I started to explore the Clojure web ecosystem. I am experimenting with different libraries such as Hiccup, Enlive, Compojure and Noir (though Noir seems to be on the brink of deprecation).

My question is actually two questions. First is on the apparant lack of conventions for building clojure web apps. And secondly I need some hints on creating 'rich' html components.

What I love about the Clojure way is the ease of making different libraries play together. Replacing enlive with hiccup and the other way around is no big deal. Everything plays its single and simple role. Very much different from a complex framework like JSF.

But there is the point: This great freedom makes me feel a bit lost. In JSF I know where everthing has its place. I use Spring to integrate all components, Spring-Security to handle all session stuff. Component libraries relieve me from the stress of dealing with html, javascript and ajax issues.

Especially the aforementioned component libraries is what I am missing with Clojure. I found myself implementing things like a datatable with features like alternating row colors, pagination, column ordering, incremental filter and so on. And it leaves me with questions on how to synchronize browser and server state of such components especially when ajax is included. I was not able to find any mature answer on the net.

The advantage of frameworks: once you understood the rules and restrictions you can build your application and concentrate on the business rules. The technical infrastructure is dealt with and shouldn't be a distraction.

What suggestions are there for the Clojure world? Is ClojureScript One a solution? I haven't yet looked into it. Does anyone know any component libraries that offer similar features like for example RichFaces datatable? Is there a preferred way of dealing with ajax?


like image 602
nansen Avatar asked Dec 16 '12 16:12

nansen


1 Answers

All I can give you are some guidelines:

  • exchange messages between client and server in JSON or EDF
  • separate your GUI code from your state-management code on the client
  • put your state-management code in crossover so you can test it outside the browser
  • arrange for your client GUI code to be as independent of a particular library as possible, go for libraries with active communities and least dependencies
like image 147
Hendekagon Avatar answered Sep 17 '22 16:09

Hendekagon