Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Compojure 0.4.0 released (groups.google.com)
52 points by rads on July 1, 2010 | hide | past | favorite | 12 comments


This is a web framework in the style of web.py or Sinatra.

I was wondering if anyone had much experience building a significant web application with one of these frameworks? Are they sufficiently powerful to enable fast development? I worry that a simple system like this might lack some of the templating and and database layers I am used to in larger frameworks such as Rails and Django?

I suppose I might just be afraid to lose having the framework do most of the work for me. It has made development quite fast.


I think it's probably a matter of taste, and also the type of project (which surely are correlated). I prefer this sort of micro-framework because it gives me control. I like my software to consist of many independent pieces that I can mix & match and then string together. The Rails approach is more the opposite, you've got the structure and fill in the gaps.

Admittedly, none of my web projects in recent years have been typical database-backed web apps. Clojure (and thus Compojure) is actually a fantastic candidate if you're keeping state in memory - STM is made for this.

On my infinite TODO list I've got an xLightweb back-end for Compojure. This would allow asynchronous I/O in the style of Node.js, something that's a bit tedious in pure Java (no closures), and Clojure has certain advantages over JavaScript/V8. I find asynchronous I/O hard to imagine in a Rails-style environment.


I'm also hoping for node.js-like development in Clojure, it seems like as a Lisp, that style of development is well suited for it. What would be great is for someone to use JNI with libevent to create a nice, fast event driven server for Clojure/Java.

Edit: I forget, does java.nio already use kqueue/epoll and friends? If so then Netty should do the trick as it uses java.nio.


There's an epoll-based implementation of the java.nio.channels.Selector so JNI should hopefully not be necessary.

I haven't tried netty yet, it seems a lot more heavyweight than xSocket/xLightweb? Or is my perception warped because it's hosted on jboss.org and the description uses "enterprise-friendly" language?


From everything I've read Netty looks like a champ compared to all other NIO servers. :-)

So, I'm quite excited to have found the answer to my question, AND someone has already started a clojure/netty project:

http://github.com/texodus/saturnine

Check out these comparisons of Netty vs others:

http://gleamynode.net/articles/2232/

http://amix.dk/blog/post/19456

http://www.znetdevelopment.com/blogs/2009/04/07/scalable-nio...

http://www.znetdevelopment.com/blogs/2009/04/09/scalable-nio...

http://www.znetdevelopment.com/blogs/2009/04/13/scalable-nio...


I asked a similar question on the Clojure group, as part of a series of questions on the state of Clojure web development. The responses can be found here, in case you're interested:

http://groups.google.com/group/clojure/browse_thread/thread/...


I found that the biggest problem was choice paralysis. I just couldn't stick to any one way of doing things. I'd start a project and rework the data layer 10 times or come up with a dozen ways to compose restful access to a data source or something like that. A big advantage of going with a framework like Rails or Django or whatever is that a lot of the big choices are already made for you.

When you pick Compojure and you start hacking, you can't help but feel isolated, and it's hard to know if what you're doing is even a good idea.

That being said, I still like Compojure for whipping up really quick/small web apps where the problem and what needs to be presented are both well suited to the sort of thing Clojure solves.


There another clojure web framework called Conjure which is similar to Rails. Might be more to your liking - http://github.com/macourtney/Conjure .


I've written a few apps with compojure. It's pretty fast development, and I like that it's so easy to write tests for a functional language but exceptions that come out of space from javaland cloud the picture.


I haven't been able to find any large (or medium size) OSS apps written in Compojure. The best I was able to dig up was http://github.com/briancarper/cow-blog .

Compojure doesn't do much for you (it's like Sinatra), I find it elegant, but it really doesn't give me the massive productivity boost Rails does.


I've used Sinatra for a couple of small webapps. It's great if you're building something that's essentially a tiny webservice. For anything with a more extensive UI or significant database I prefer Rails/Django because most of the grunt work is already done for you in the bigger frameworks.


If you are writing simple services for passing JSON back and forth then something like this is great because it gives you the right amount of control.

If you are writing full blown end user web applications then you are better off sticking with Rails until something more mature comes along, IMHO.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: