State of Clojure web development

470 views
Skip to first unread message

James Reeves

unread,
Jun 23, 2010, 5:23:16 PM6/23/10
to Clojure
Hello there!

Chas Emerick's recent "State of Clojure" survey [http://bit.ly/dtdAwb]
indicated that a significant proportion of Clojure users are beginning
to use Clojure for web development. A recent Hacker News posting
[http://bit.ly/91Bu5J] seems to corroborate these results, with
several Clojure-based web applications already out in the wild.

As one of the main developers of Ring and Compojure, I'd be very
interested to hear more about how people are using Clojure to build
web apps. To this end, I have a few questions I'd like to quiz Clojure
web developers about:

1. Have you written, or are you writing, a web application that uses
Clojure? What does it do?

2. Which libraries or frameworks are you using? Which versions?

3. What made you choose Clojure to develop web applications in? What
are the strengths of Clojure web development?

4. What do you think are the current weaknesses of web development in
Clojure? What could be improved?

5. Anything else you want to comment on?

Please reply to this thread with your answers, and thank you very much
in advance for your time. I really appreciate any feedback you can
provide.

- James

Sean Corfield

unread,
Jun 23, 2010, 7:34:35 PM6/23/10
to clo...@googlegroups.com
On Wed, Jun 23, 2010 at 2:23 PM, James Reeves
<weave...@googlemail.com> wrote:
> 1. Have you written, or are you writing, a web application that uses
> Clojure? What does it do?

I don't know that I'll be writing entire web applications in Clojure
any time soon but I expect to be using Clojure in some form from
(essentially) Java-based web applications some time soon, much as I
currently use Groovy and/or Scala for parts of a web application. I'll
be interested in both the easiest and most performant ways to use
Clojure code from something Java based. FWIW, I use CFML (running on
Railo, a free open source JBoss community project, that compiles CFML
down to Java bytecode and runs in a Servlet container) as my primary
web templating / scripting language right now and drop down to other
languages where useful / appropriate.

Looking forward to hearing how others are doing web development with
Clojure! Thanx for kicking off this thread James.
--
Sean A Corfield -- (904) 302-SEAN
Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

Joost

unread,
Jun 23, 2010, 7:55:42 PM6/23/10
to Clojure
On Jun 23, 11:23 pm, James Reeves <weavejes...@googlemail.com> wrote:
> Hello there!

Hi James!

:)


> 1. Have you written, or are you writing, a web application that uses
> Clojure? What does it do?

I've written one very simple "internal organsiation" site in clojure
that's finished except for a few little bugs. Should be cleared next
monday.

> 2. Which libraries or frameworks are you using? Which versions?

compojure in whatever was the last release version - with a few lines
of patches.
joda-time 1.6 - which should be mandatory for any java/clojure project
dealing with time in any way
and lucene 3.0.1

> 3. What made you choose Clojure to develop web applications in?

I hate typing any more than is needed. This means a Lisp variant.
Clojure is just the best Lisp I know to program in, and the JVM is a
bonus if you need it.

> What are the strengths of Clojure web development?

See the previous question. Plus "pure" functional programming meshes
well with typical Front end - Controller - Database web programming.

> 4. What do you think are the current weaknesses of web development in
> Clojure? What could be improved?

Not sure. Will get back on this. I will say that anyone claiming to
have a full integrated solution in clojure right now is probably
wrong. And I'm not sure we need an integrated system at all. Which is
why I like compojure splitting up into real composable parts.

> 5. Anything else you want to comment on?

Stick with relational databases unless you really need to get rid of
them.

Don't think of the previous sentence as an excuse to squeeze/enforce
an OO/relational mapping in whatever web framework you're thinking of
writing. I'm doing fine without one, thank you very much.

Cheers,
Joost Diepenmaat
Zeekat Softwareontwikkeling.
http://joost.zeekat.nl/

Joost

unread,
Jun 23, 2010, 8:27:08 PM6/23/10
to Clojure
On Jun 24, 1:55 am, Joost <jo...@zeekat.nl> wrote:
> compojure in whatever was the last release version - with a few lines
> of patches.

This may be interesting to anyone in the US or Japan:

All the patches I made were to fix UTF-8 handling. I live in Europe.
We use characters like Ø and ß and you'd better get used to it.

Chas Emerick

unread,
Jun 23, 2010, 8:30:21 PM6/23/10
to clo...@googlegroups.com
James,

First, thank you for all of your work in this area. It is greatly
appreciated. My answers follow:

1. DocuHarvest ( https://docuharvest.com ), which I've already talked
about here. Broadly speaking, it extracts data from documents, and
it's just getting started.

2. Relevant to web development, DocuHarvest uses compojure 0.3.x
(modified to suit clojure 1.2 HEAD), HEAD of enlive and clutch, spring-
security v3, jetty for local development, Tomcat for staging and
production environments, and enclojure's REPL server library in all
environments.

3. Compojure gets me very close to the metal, or as much as one can be
w.r.t. HTTP. Middleware is the pleasant superset of all other flavors
of web request handling; helluva lot of power there with very little
cost. Mix that with a solid REPL (via enclojure for me) for zero-
turnaround development, and I'm very, very happy.

4. I want to be able to define HTTP APIs more concisely. compojure-
rest (http://github.com/ordnungswidrig/compojure-rest) and clj-conneg (http://github.com/rnewman/clj-conneg
) are pointing the way towards what the response to that looks like, I
think.

The most common issues I see are related to packaging and deployment.
I think this could probably be made easier for those that aren't
familiar with the java way of doing webapp deployment. Getting people
familiar with the (honestly simple) mostly-canned tooling solutions
that are out there would help, but short of that, perhaps a pre-
compiled servlet (configured via a web.xml file that defines the top-
level route that all requests are dropped into, etc) would help.
Building the war file would still be necessary, but that's when-in-
Rome territory. IMO, every time someone deploys a compojure app via a
hacked-up shell script and embedded jetty, a kitten is killed. ;-)

5. I better quit while I'm ahead for today!

And no, thank you, and everyone else that's made web development with
Clojure as pleasant as it is! :-D

- Chas

Brian Carper

unread,
Jun 23, 2010, 9:11:38 PM6/23/10
to Clojure
On Jun 23, 2:23 pm, James Reeves <weavejes...@googlemail.com> wrote:
> 1. Have you written, or are you writing, a web application that uses
> Clojure? What does it do?

My blog and a couple of other blog-like hobby sites. I also wrote a
small standalone data-collection app at work. It collects survey data
for psych research.

> 2. Which libraries or frameworks are you using? Which versions?

[[org.clojure/clojure "1.2.0-master-SNAPSHOT"]
[org.clojure/clojure-contrib "1.2.0-SNAPSHOT"]
[compojure "0.4.0-RC3"]
[hiccup "0.2.4"]
[clout "0.2.0"]
[ring/ring-jetty-adapter "0.2.0"]
[ring/ring-devel "0.2.0"]
[oyako "0.1.1"]
[postgres-pool "1.1.0"]
[joda-time "1.6"]
[rhino/js "1.7R2"]
[sandbar/sandbar "0.2.3"]]

I try to stick with bleeding-edge versions of almost everything. You
almost have to, things change too quickly.

> 3. What made you choose Clojure to develop web applications in? What
> are the strengths of Clojure web development?

DSL-based HTML generation (as per Hiccup) is a huge selling point for
me. Nothing else compares. Lispy interactive development via REPL is
great for webapps. Web development is a good place to take advantage
of macros and other boilerplate-elimination techniques that a Lisp
gives you.

I mostly chose Clojure for web development mostly because I like
Clojure and wanted an excuse to use it more.

> 4. What do you think are the current weaknesses of web development in
> Clojure? What could be improved?

Deployment is my main headache. Better documentation / more examples
for Compojure and other libs would be very useful. DB interaction /
data persistence is a bit of a weakness, but the Clojure world is
improving very quickly in this area.

> 5. Anything else you want to comment on?

Web development in Clojure is loads of fun. Thanks for your work on
Ring/Compojure/etc., they're great tools.

--Brian

Hugo Duncan

unread,
Jun 23, 2010, 9:19:51 PM6/23/10
to clo...@googlegroups.com
On Wed, 23 Jun 2010 17:23:16 -0400, James Reeves
<weave...@googlemail.com> wrote:

> 1. Have you written, or are you writing, a web application that uses
> Clojure? What does it do?

I'm writing cloudhoist.com, a cross cloud management console and api, that
lets you start and stop nodes on Amazon, Rackspace, etc, configure them
with your favourite stacks (eg, tomcat, mysql, couchdb), deploy you apps
and carry out admin actions.

> 2. Which libraries or frameworks are you using? Which versions?

Ring, moustache, enlive, scriptjure, clutch. All latest versions. Jetty,
tomcat, nginx.

> 3. What made you choose Clojure to develop web applications in? What
> are the strengths of Clojure web development?

It's a lisp, with all that entails, and it deploys nicely on the JVM.

> 4. What do you think are the current weaknesses of web development in
> Clojure? What could be improved?

I am interested in using clojure for client side coding. Ring friendly
authentication and authorisation libs would be nice (I rolled my own). I
miss rails' named routes, but am sure something better will materialise
for clojure.

> 5. Anything else you want to comment on?

Thanks to everyone for their work in this area!

--
Hugo Duncan

Meikel Brandmeyer

unread,
Jun 24, 2010, 2:00:28 AM6/24/10
to Clojure
Hi,

On Jun 23, 11:23 pm, James Reeves <weavejes...@googlemail.com> wrote:

> 1. Have you written, or are you writing, a web application that uses
> Clojure? What does it do?

I'm guerilla coding a small web app to do some very non-standard
statistical analysis of customer returns (ABS/ESC systems for cars).
The whole thing is in stealth mode. So it won't ever be released to
the public. (When I look at the code, I have to say: "Luckily!") It is
a webapp to allow some closely related departments to access the
information w/o having to deploy an app.

> 2. Which libraries or frameworks are you using? Which versions?

compile 'org.clojure:clojure:1.1.0'
compile 'org.clojure:clojure-contrib:1.1.0'
compile 'enlive:enlive:1.0.0-SNAPSHOT'
compile 'ring:ring-core:0.2.0'
compile 'ring:ring-devel:0.2.0'
compile 'ring:ring-jetty-adapter:0.2.0'
compile 'moustache:moustache:1.0.0-SNAPSHOT'
compile 'net.sf.opencsv:opencsv:2.1'
compile 'clj-stacktrace:clj-stacktrace:0.1.0-SNAPSHOT'
compile 'congomongo:congomongo:0.1.0-SNAPSHOT'
compile 'joda-time:joda-time:1.6'
compile 'jfree:jfreechart:1.0.12'
compile 'jasperreports:jasperreports:3.5.3'

> 3. What made you choose Clojure to develop web applications in? What
> are the strengths of Clojure web development?

It's a lisp and my exclusive language for hobby projects since March
2008. The only other language I have a comparable knowledge is C. And
I didn't want to start with C. Also deploy: Java is here ubiquitous. I
can just take a plain jar to some machine and am done. (I'm didn't
kill a kitten. I sacrificed a puppy instead.) I have an embedded
nailgun server my vimclojure talks to. So I can hot swap functions and
immediately test in the browser. (I'm sure there are better ways to do
this, but at the moment this is efficient enough for me)

> 4. What do you think are the current weaknesses of web development in
> Clojure? What could be improved?

I can't say anything for that one. I would have to learn how to write
a webapp first.

> 5. Anything else you want to comment on?

Clojure is fun. :)

Sincerely
Meikel

Adrian Cuthbertson

unread,
Jun 24, 2010, 4:07:16 AM6/24/10
to clo...@googlegroups.com
> 1. Have you written, or are you writing, a web application that uses
> Clojure? What does it do?

I am and have been extending an existing production java web
application environment with all new server work now being done in
clojure. It is a complex jvm server running tomcat and other threaded
proprietary services and integration paths into back-end feed systems.
Front-end stuff, previously jsp is now all being replaced by
javascript/jquery and ajax.

I am also working on a netty/clojure setup to create some distributed
event-driven processes for scaling up the services and in the future
replacing most of the the above in-jvm/threaded routines. Down the
line I hope to release some of this as open-source.

> 2. Which libraries or frameworks are you using? Which versions?

In the early stages, I tried compojure, but my setup needed much
tighter java/clojure interop and hence most of my effort has gone in
that direction. I do use enlive, joda-time, jfreechart and a bit of
clj-html/hiccup. Java libs - tomcat, log4j, apache-commons,
postgresql-jdbc. Plus many person-years of various proprietary java
and unix utility libraries for (hosted) infrastructure and operations
management. Generally I have found most of the other java frameworks
too "heavy" for my rather close-to-the-wire preferences.

> 3. What made you choose Clojure to develop web applications in? What
> are the strengths of Clojure web development?

I learnt a bit of lisp way back but career-wise all my work has
generally been c/c++/java based. I spent about 9 months with scala
hoping for an improved jvm capability, but found it too tedious when
trying to work on the complex setup mentioned above. Happened upon
clojure 18 months ago and this was the holy-grail incarnate. You
really can get pretty close to expressing directly what's in your
mind. Haven't looked back since.

> 4. What do you think are the current weaknesses of web development in
> Clojure? What could be improved?

Plenty of room for event-driven techniques, javascript/jquery
generation stuff, distributed processing, disk-based persistence, etc.
The new protocols/types/records and the coming primitives improvements
are very exciting.

> 5. Anything else you want to comment on?

Performance, performance, performance and by the way, performance.
When you run server applications, especially non-blocking, event
driven, every little milli-second per function counts hugely when
scaling up to thousands, tens of thousands or more asynchronously
accessed services. Clojure has done wonders in eliminating boilerplate
tedium and maintenance grovel, so generally I would now like to focus
on improving my reality of 30% coding, 70%
tuning/benchmarking/refactoring.

- Regards, Adrian.

Jimmy

unread,
Jun 24, 2010, 8:12:46 AM6/24/10
to Clojure
Hi James,
For me the big missing item is Comet/Websockets support. More and more
of the web
development I do requires near real time communication and to have
that feature integrated
in the framework (like lift) would be great.
thanks
Jimmy

Wilson MacGyver

unread,
Jun 24, 2010, 11:52:02 AM6/24/10
to clo...@googlegroups.com
On Wed, Jun 23, 2010 at 5:23 PM, James Reeves
<weave...@googlemail.com> wrote:
> 1. Have you written, or are you writing, a web application that uses
> Clojure? What does it do?

we are currently developing a game server backend using clojure.

> 2. Which libraries or frameworks are you using? Which versions?
>

we are using grails for the web app aspect, and uses the grails
plugin to call clojure code.

> 3. What made you choose Clojure to develop web applications in? What
> are the strengths of Clojure web development?

in this case, we are really using grails for the web aspect, but uses
clojure for AI and game logic. clojure is very good at that.

>
> 4. What do you think are the current weaknesses of web development in
> Clojure? What could be improved?
>

too many scattered libraries and approaches. For me, it's about
problem solving. I would like to be able to just grab something, and
get it started. Right now, if a new clojure user ask, I want to develop
a web app, what should I use? Compojure? Ring? What template
system should I use? enlive? str html? hiccup? How do you deal with
database? clj-record? clojuresql? How do you make outbound
REST request?

> 5. Anything else you want to comment on?

clojure is still young. I hope in time, a web dev approach that's
more clojure-ish. lift has done a good way to show what a web
framework using scala and functional style would look like.

I look forward to see something like this for clojure one day.

--
Omnem crede diem tibi diluxisse supremum.

Daniel Gagnon

unread,
Jun 24, 2010, 12:27:28 PM6/24/10
to clo...@googlegroups.com
I don't use Clojure for web development and I thought sharing why could be useful too.

For web development, my favourite tool is Django. It comes as a fullstack framework which means I have everything I need out of the box. Templates, caching, ORM, a kick-ass autogenerated admin section, cross-domain request forgery protection etc. and the documentation is really top notch.

I'd rather have Clojure than Python but all the goodness that Django provides is such a time saver that I feel I'd lose too much time with Clojure.

If I had a full-stack, well-documented clojure framework, I'd jump to that.

MarkSwanson

unread,
Jun 24, 2010, 12:39:11 PM6/24/10
to Clojure

>
> 1. Have you written, or are you writing, a web application that uses
> Clojure? What does it do?

I've created a commercial app that has the server side written start
to finish in Clojure. It leverages the existing calendaring and
scheduling functionality of ScheduleWorld - which was written in Java.
(It was trivial to do this using
Clojure)

http://www.ScheduleWorld.com/em
(It came out of beta last week.)

> 2. Which libraries or frameworks are you using? Which versions?

Compojure - patched from git now and then to work with Clojure 1.2.

> 3. What made you choose Clojure to develop web applications in? What
> are the strengths of Clojure web development?

It's difficult to answer this in a couple of sentences - all of
strengths of Clojure come into play here. Rich's videos that explain
the strengths of Clojure all turn out to be true.
I've been coding enterprise server-side services for ~20 years using C/
C++/Java.
Compared to C/C++/Java I've found the strengths of Clojure beget:

1. better designs
2. less bugs: immutable data, better designs, STM, atoms, ...
3. faster code given the same effort: lazy sequences, memoization,
clojure.[core,contrib],
4. better productivity: the REPL, the Clojure language, etc. it all
snowballs here.

> 4. What do you think are the current weaknesses of web development in
> Clojure? What could be improved?

weaknesses: none really. I sometimes miss the perfect command
completion (with auto import generation) provided by Eclipse/Java when
I do Java interop. But this is an editor issue. (And I'm really happy
with vimclojure.)

Improved: I think I'd be happy with Clojure and Compojure as they
stand for a long time. But since you asked:

LOGGING: The current logging capabilities are not useful to people
creating services with lots of users. The only way logging is useful
is to have one file peruser logging. We wrote our own logging system
that does this and it works great. At midnight the logging system
creates a new directory (based on the date) andstarts using that. So
if someone emails and says at this date/time operation X failed we can
easily analyze the logs around that time.
(A while back ScheduleWorld was signing up 800 people / day with 8000
simultaneous established http connections doing work. Imagine the
intertwined logging data...Per user logging is the best way.)


> 5. Anything else you want to comment on?

Thank you for creating Compojure.
1. defroutes = excellent way of defining our services.
2. decorate = fantastic fine-grained way for us to decorate our
services.
3. requests just have to return a map. Excellent.

Compojure is simple to use and never gets in the way. We have nginx
fronting a cluster of boxes. Our Compojure services respond to
requests, and sometimes theyalso dynamically create and manage static
responses (nginx returns a static file if the request has been seen
before and no other request invalidates the cached response).

(The other Clojure web frameworks might be as good. I don't meant to
take anything away from them. I have only used Compojure.)

Cheers.

Brenton

unread,
Jun 24, 2010, 1:17:53 PM6/24/10
to Clojure
1. Have you written, or are you writing, a web application that uses
Clojure? What does it do?

I am an independent contractor and do a lot of corporate intranet web
applications. All of my clients support Java. Each year I write a few
new applications and spend a lot of time maintaining old Java
applications. The first new application that I wrote this year was
pure Clojure. It was a very simple application for collecting ideas
from employees. It was great to be able to use Lisp and yet integrate
and deploy into a Java environment. The application was deployed to
WebSphere as a war file, connects to an SQL Server database and uses
the company's LDAP Java libraries. I plan to use Clojure for all new
projects.

I also work for a research group with a bunch of statisticians
building web based tools based on the work that they do. Usually
taking some nasty spreadsheet that someone has created and turning it
into a web application. Clojure (functional programming) with Incanter
will be a perfect fit for this type of project.

2. Which libraries or frameworks are you using? Which versions?

[org.clojure/clojure "1.1.0"]
[org.clojure/clojure-contrib "1.1.0"]
[compojure "0.4.0-RC3"]
[hiccup "0.2.3"]
[sandbar "0.2.4"]
[enlive "1.0.0-SNAPSHOT"]
[carte "0.1.0"]
[inflections "0.3"]

I am also working on Sandbar and Carte. Sandbar provides middleware to
allow one to work with the session as if it were a global map with put
and get functions. It also provides middleware for authentication and
authorization. Carte is non-object oriented relational mapping. Both
are very new.

3. What made you choose Clojure to develop web applications in? What
are the strengths of Clojure web development?

1. Functional programming is a better fit than OO for web
applications.
2. Lisp is as DRY as you can get. Every other environment that I have
worked in, you get to some point where you can no longer create
abstractions and have to resort to design patterns, code generation or
non-primary language configuration. I don't see this ever happening
with Clojure.
3. It is just Java. Easy deployment into any Java container. Clients
get a Java app and there is much rejoicing.
4. Mutable objects as a default are bad, even for web applications.
5. Interactive REPL development.
6. Ring and Compojure are exactly what I want as the foundation for my
web applications: simple, small and extensible. Middleware is
wonderful.

4. What do you think are the current weaknesses of web development in
Clojure? What could be improved?

Packaging and deployment seem to be the big problem at this point. I
have a lot experience with Java web applications so it is not that
difficult for me to create a war for deployment but I can see that
someone without a Java background would be completely confused by
this. I would love to see a tool that can package my app into a war
including a REPL server.

It would also be nice to have easily accessible, thorough,
documentation for Ring and Compojure with example code that goes
beyond the most simple cases. The community is young and so there is a
lack of shared knowledge about best practices when developing larger
applications.

One of the things that I like about Clojure web development (the
flexibility) also causes some concern. In my opinion, the best thing
about Rails is that any developer who knows Rails can go to any Rails
project and know where everything is. The conventions of Rails have
also contributed greatly to Rails' ability to grow and innovate. I
don't know what the solution is, just wanted to bring this up.

5. Anything else you want to comment on?

Many thanks to Mark and James for all of your work on Ring and
Compojure. Without these two libraries there wouldn't be much Clojure
web development going on. Also, thanks for keeping it simple and not
trying to do too much.

Chas Emerick

unread,
Jun 24, 2010, 1:44:09 PM6/24/10
to clo...@googlegroups.com
Good point. I have a todo waiting for me to figure out how to deliver
some services that HTTP might not be cut out for. It looks like v3.0
servlets have a variety of enhancements in this area, so hopefully
compojure/ring can stand on those shoulders. I've no idea about the
container support in that area though.

- Chas

> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient
> with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

Martin Jul

unread,
Jun 24, 2010, 2:15:04 PM6/24/10
to Clojure
We have written a currency trading app in Clojure in my company.
It has an embedded web server with a compojure app that provides an
administration interface.

2. Which libraries or frameworks are you using? Which versions?

Some relevant dependencies are:


[compojure "0.4.0-SNAPSHOT"]
[hiccup "0.2.1"]
[ring/ring-devel "0.2.0"]
[ring/ring-httpcore-adapter "0.2.0"]
[ring/ring-jetty-adapter "0.2.0"]
[ring/ring-servlet "0.2.0"]
[commons-fileupload/commons-fileupload "1.2.1"]]

3. What made you choose Clojure to develop web applications in? What
are the strengths of Clojure web development?

The entire app is Clojure and Compjure/Hiccup is very powerful so we
could build the web UI surprisingly quickly and in very little code.
The order of magnitude simplification reminds me of switching to Rails
and how it made everything prior to that look bloated and complex by
comparison. Compojure is to Rails what Rails is to ASP.NET.


4. What do you think are the current weaknesses of web development in
Clojure? What could be improved?

At the time we needed an easy way to bind configuration information to
the routes (we ended up wrapping each request with the configuration
data which is a bit cumbersome). A more explicit way would be to use
some kind of partial evaluation to bind the relevant settings to each
route.

5. Anything else you want to comment on?

Clojure and Compojure rock! Thanks for your work on the library :-)

Tim Robinson

unread,
Jun 24, 2010, 3:12:37 PM6/24/10
to Clojure


1. Have you written, or are you writing, a web application that uses
Clojure? What does it do?

I am new to Clojure, I've ported over most of my code for an ad-hoc
application creator / with reporting and GIS integration.
I'm pretty much finished. I benchmarking speed.

2. Which libraries or frameworks are you using? Which versions?

My own custom frameworks. I use some contrib stuff.

3. What made you choose Clojure to develop web applications in? What
are the strengths of Clojure web development?

Strengths:
* Allows for creating succinct code to manage complex data.
* Access to many libraries (that are current and active).
* Not forced to include BS code for OO abstractions.

Weakness:

REPL errors. Seems fragile. If I hit an error, some errors corrupt
something under the hood,
ie. reloading the corrections doesn't help I have to close the REPL
then restart.
I'm familiar with REPLs - This is odd, but it's probably a JVM issue.

4. What do you think are the current weaknesses of web development in
Clojure? What could be improved?

Nothing big yet.

5. Anything else you want to comment on?

Only one week into Clojure I could be too green, but:

I would like some chaining to less the brackets.
i.e.

> (def stuff {:key1 {:item1 {:sub1 val1}})
> (((stuff :key1) :item1) sub1) <------- YUCK
val1

Instead do this:
> stuff:key1:item1:sub1
val1

Also, some of the function names don't make sense:
(def stuff (list 1 2 3 4 5))
> (rest stuff)
(2 3 4 5)
> (next stuff)
(2 3 4 5) <---- this can be done with rest.

In my mind 'next' should:
> (next stuff)
2
> (next 2 stuff)
(2 3)

etc etc......

Tim

David Nolen

unread,
Jun 24, 2010, 3:48:36 PM6/24/10
to clo...@googlegroups.com
On Thu, Jun 24, 2010 at 3:12 PM, Tim Robinson <tim.bl...@gmail.com> wrote:

> (def stuff {:key1 {:item1 {:sub1 val1}})
> (((stuff :key1) :item1) sub1)  <------- YUCK
val1

(get-in m [:key1 :item1 :sub1]) <------- YUM ;) 
 
> (rest stuff)
(2 3 4 5)
> (next stuff)
(2 3 4 5) <---- this can be done with rest.

There are subtle but important differences between next and rest. You should refer to their documentation.

Oh yeah, and web development with Clojure rocks:

[enlive "1.0.0-SNAPSHOT"]
[net.cgrand/moustache "1.0.0-SNAPSHOT"]
[ring "0.2.3"]
[clj-time "0.1.0-SNAPSHOT"]
[com.twinql.clojure/clj-apache-http "2.1.0"]

At the moment I use nginx proxying to embedded Jetty. Works fine for me, though I'm interested in hearing or reading documentation about what other people are doing.

Meikel Brandmeyer

unread,
Jun 24, 2010, 3:48:53 PM6/24/10
to clo...@googlegroups.com
Hi,

Am 24.06.2010 um 21:12 schrieb Tim Robinson:

> I would like some chaining to less the brackets.
> i.e.
>
>> (def stuff {:key1 {:item1 {:sub1 val1}})
>> (((stuff :key1) :item1) sub1) <------- YUCK
> val1
>
> Instead do this:
>> stuff:key1:item1:sub1
> val1

(-> stuff :key1 :item1 sub1)

> Also, some of the function names don't make sense:
> (def stuff (list 1 2 3 4 5))
>> (rest stuff)
> (2 3 4 5)
>> (next stuff)
> (2 3 4 5) <---- this can be done with rest.

next and rest are not the same. See http://clojure.org/lazy.

Sincerely
Meikel

David Nolen

unread,
Jun 24, 2010, 3:56:55 PM6/24/10
to clo...@googlegroups.com
full-stack frameworks take time to evolve, and even then for many projects they aren't a good fit since they impose a both narrow perspective and a heavy cognitive load (massive APIs). In my experience development in Clojure is just as fast as it is in Django. The main thing lacking is documentation of the Clojure goodies that are currently available.

David

Tim Robinson

unread,
Jun 24, 2010, 4:07:07 PM6/24/10
to Clojure

Thanks for both the replies.

(get-in m [:key1 :item1 :sub1]) <------- YUM ;)

(-> stuff :key1 :item1 sub1)

are better than what I've been doing!

Re: (next...)

I still like mine better, fortunately I can create my own functions,
but I was just highlighted that some of the function names are not
intuitive (to me).
Most of them are good.

Along this vein, I find the documentation is great, but a little hard
to navigate around.
Example to find a list of predicates requires hunting. Is there a
trick? I know ' source' and 'find-doc', but I'm constantly
searching :)
This is a really niggly point since relatively speaking it's well
done.

As I said, I'm green. I'll get there soon I promise :)

Tim

j-g-faustus

unread,
Jun 24, 2010, 4:26:37 PM6/24/10
to Clojure
> 1. Have you written, or are you writing, a web application that uses
> Clojure? What does it do?

Recently started writing a webapp to display financial data, along the
lines of Google finance. Although somewhat less ambitious :).

> 2. Which libraries or frameworks are you using? Which versions?

Enlive, latest version. (Downloaded last week, don't know the version
number.) Aiming for mostly static HTML, JavaScript/JSON, a few
servlets and CouchDB.


> 3. What made you choose Clojure to develop web applications in? What
> are the strengths of Clojure web development?

* I've been doing Java/JSP web development for years, it is stable,
has tons of libraries and performs well, but is somewhat cumbersome do
develop in.
* I've been doing a little web development in Ruby/Ruby on Rails.
Development is much quicker and nicer, especially with HAML (a
templating library). The disadvantage is performance issues - Ruby is
lousy on numerical computation.
* I had just started looking into server-side JavaScript (like
Node.js). The primary disadvantage is that it is very new and
unproven, and there are few libraries available yet.
* I also considered Google's Go, and was aiming for a combination of
Go for the heavy lifting and Ruby for templates and display.

I think Clojure hits a sweet spot with better performance than purely
dynamic languages like Ruby and less verbosity than Java. For me that
means I can stick with one language, which is always less hassle than
using several.

I used Common Lisp several years back, and liked it a lot, so I
welcome a modern Lisp on a mature platform.

The REPL is very helpful in allowing quick iterations.

Libraries are not an issue with Java underneath, and the Clojure-
specific libraries seem to be in decent shape as well.
The Enlive template system is simply brilliant, I know of nothing even
close in conveniently separating HTML/design and application logic.

All in all, I can't think of a better option at the moment.


> 4. What do you think are the current weaknesses of web development in
> Clojure? What could be improved?

In general Clojure web development is in early stages yet, it can't
compete with the maturity of Java or Ruby frameworks. But that goes
with the territory, it's one of the costs of trying something new. And
I can always drop down to Java if needed.

Documentation is highly variable, I'm not entirely happy with having
to read source code to figure out an API.

For anything more specific, it's too early for me to tell, I can
probably say more about it in a month or two. Perhaps database
connections, although since there is plenty of DB support in Java,
writing a small Clojure wrapper seems manageable.


> 5. Anything else you want to comment on?

Not really. Keep up the good work :)

Meikel Brandmeyer

unread,
Jun 24, 2010, 5:35:49 PM6/24/10
to clo...@googlegroups.com
Hi,

Am 24.06.2010 um 22:07 schrieb Tim Robinson:

> Along this vein, I find the documentation is great, but a little hard
> to navigate around.

http://richhickey.github.com/clojure
http://richhickey.github.com/clojure-contrib

Note the branch links on the top left.

Sincerely
Meikel

Mike Meyer

unread,
Jun 24, 2010, 9:46:24 PM6/24/10
to clo...@googlegroups.com
> 1. Have you written, or are you writing, a web application that uses
> Clojure? What does it do?

roman candle is a web app designed to let me control X10 plc
components from any web-capable device, using the X10 firecracker
controller. It's still in very early development, and hasn't been
given much attention lately. The intent is more to learn about clojure
rather than provide a distributable utility.

> 2. Which libraries or frameworks are you using? Which versions?

I've always been impressed by the Seaside framework, if only it
weren't tied to smalltalk. While there are now some C/C++ frameworks
along this line, there don't appear to be any available for Java, much
less clojure. So I'm developing a small framework - bitchen' - in
parallel with roman candle. This is also more pedagogical than
production, in that it's not at all clear how to "port" the seaside
model from an OO language to a functional/immutable one like Clojure.
Should I decide that I'm going to get serious about clojure, this
might eventually become a full-fledged framework.

> 3. What made you choose Clojure to develop web applications in? What
> are the strengths of Clojure web development?

Wanting to provide a better answer to that question. Clojure itself is
interesting for it's LISPyness, concurrency facilities, and tight
integration with the JVM.

> 4. What do you think are the current weaknesses of web development in
> Clojure? What could be improved?

The tight integration with the JVM. I believe it's brought more pain
than happiness.

> 5. Anything else you want to comment on?

Not really.

<mike
--
Mike Meyer <m...@mired.org> http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

Howard Lewis Ship

unread,
Jun 24, 2010, 10:29:00 PM6/24/10
to clo...@googlegroups.com
On Wed, Jun 23, 2010 at 2:23 PM, James Reeves
<weave...@googlemail.com> wrote:
> Hello there!
>
> Chas Emerick's recent "State of Clojure" survey [http://bit.ly/dtdAwb]
> indicated that a significant proportion of Clojure users are beginning
> to use Clojure for web development. A recent Hacker News posting
> [http://bit.ly/91Bu5J] seems to corroborate these results, with
> several Clojure-based web applications already out in the wild.
>
> As one of the main developers of Ring and Compojure, I'd be very
> interested to hear more about how people are using Clojure to build
> web apps. To this end, I have a few questions I'd like to quiz Clojure
> web developers about:
>
> 1. Have you written, or are you writing, a web application that uses
> Clojure? What does it do?
>

I'm writing a framework, Cascade.

http://wiki.github.com/hlship/cascade/

> 2. Which libraries or frameworks are you using? Which versions?

So far, no dependencies ... but I may switch out some ad hoc logic for
stuff from Ring. Even I try not to reinvent the wheel every time!

>
> 3. What made you choose Clojure to develop web applications in? What
> are the strengths of Clojure web development?

I eventually hope to have Cascade handle parallel rendering of the
overall content across multiple threads, which makes sense when
rendering a single view requires multiple database queries that can
execute in parallel.

Partly Cascade exists as a way to learn Clojure fully, even if I don't
use Cascade professionally in the meantime. For most projects, I'll
keep using Tapestry :-)

However, I do really like having the template be Clojure forms.

Unlike Compojure/Hiccup, the Cascade templates are rendered to an
intermediate DOM format that can be manipulated before final streaming
as text. There are advantages to this, learned from Tapestry, in terms
of coordinating individual rendering functions (what might be
components in Tapestry) ... especially w.r.t. the inclusion of
stylesheets and JavaScript libraries. These are done declaratively in
Cascade.


For the most part, it was easier to get live reloading working in
Cascade than in Tapestry (in Tapestry, change a class, it is reloaded.
In Cascade, change a namespace, it is reloaded). There are still some
issues, especially when there are errors in the reloaded namespace.

>
> 4. What do you think are the current weaknesses of web development in
> Clojure? What could be improved?

Clojure's native exception reporting is weak! Cascade improves on
this in a couple of ways (some of which may have been picked up by
Compojure).

>
> 5. Anything else you want to comment on?

For what I've heard, I'm not the first person to implement an
application in Cascade, which floors me. It's really at the research
project level right now, but I do like what I've managed so far.

>
> Please reply to this thread with your answers, and thank you very much
> in advance for your time. I really appreciate any feedback you can
> provide.
>
> - James
>

> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

--
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

Sean Allen

unread,
Jun 25, 2010, 1:01:20 AM6/25/10
to clo...@googlegroups.com
On Wed, Jun 23, 2010 at 5:23 PM, James Reeves
<weave...@googlemail.com> wrote:
> Hello there!
>
> Chas Emerick's recent "State of Clojure" survey [http://bit.ly/dtdAwb]
> indicated that a significant proportion of Clojure users are beginning
> to use Clojure for web development. A recent Hacker News posting
> [http://bit.ly/91Bu5J] seems to corroborate these results, with
> several Clojure-based web applications already out in the wild.
>
> As one of the main developers of Ring and Compojure, I'd be very
> interested to hear more about how people are using Clojure to build
> web apps. To this end, I have a few questions I'd like to quiz Clojure
> web developers about:
>
> 1. Have you written, or are you writing, a web application that uses
> Clojure? What does it do?

I considered it but I needed comet support and didn't want to roll my own
when my practical clojure experience was limited. I think that
clojure would be an excellent platform for what I was planning on doing
but it lacked the comet support I needed so I'm implementing in Seaside
for Gemstone's Smalltalk.

pavelludiq

unread,
Jun 25, 2010, 5:29:54 AM6/25/10
to Clojure
> 1. Have you written, or are you writing, a web application that uses
> Clojure? What does it do?

I've written a few small web apps.

> 2. Which libraries or frameworks are you using? Which versions?

ring and compojure

> 3. What made you choose Clojure to develop web applications in? What
> are the strengths of Clojure web development?

Im inexperienced enough to not know better :D I've been coding
seriously for about 2 and a half years, most of that using different
lisps(i got to scheme really early in my endeavor for programming
knowledge), im sold on the whole functional programming and lisp
thing. I didn't have to unlearn too much to figure it out, just a bit
of python. So, since clojure is my favorite language *at the moment*,
its natural to try and write stuff in it, and web development seems as
good as any place to start.

> 4. What do you think are the current weaknesses of web development in
> Clojure? What could be improved?

Im not very experienced in web development to say for sure. I've
written a blog in django, and thats all my web experience. So my first
problem was figuring out how to write web apps in general. I think
clojure is a lousy first web language at the moment. Rings docs kind
of assume you already know what you are doing. I had to figure
everything out for myself, i read all the source so i can figure it
out, and i still have trouble with it. I'd say that ring/compojure
could use a comprehensive tutorial with lots of examples and tips.

> 5. Anything else you want to comment on?

I love hiccup, ever since i first saw a web app written in a lisp
using s-expressions to generate html, i've been in love with the idea.
Also as someone already pointed out in the "State of Clojure" survey,
Rich really does have awesome hair :D

martin_clausen

unread,
Jun 25, 2010, 9:13:01 AM6/25/10
to Clojure
Regarding deployment leiningen-war might prove useful
http://github.com/alienscience/leiningen-war.

Luc Préfontaine

unread,
Jun 25, 2010, 10:33:47 AM6/25/10
to clo...@googlegroups.com
Were not using Clojure yet for our
Web based GUIs.
The main reason being that we jumped
on Rails last year. Most of our needs
are to display/edit database data and
the ActiveScaffold plugin allows us
to write a controller in 20 lines.

We do not need to write forms,
it's all done through partial renderings
provided by the plugin.

We just provide layouts and customize
CSS stuf.

We will give a closer look to 
Compojure this year and see if can
achieve the same code ratio somehow.

Luc P

Sent from my iPod
--

Mark Engelberg

unread,
Jun 25, 2010, 1:12:57 PM6/25/10
to clo...@googlegroups.com
> On 2010-06-24, at 12:27, Daniel Gagnon <redal...@gmail.com> wrote:
>
> I don't use Clojure for web development and I thought sharing why could be
> useful too.
>
> For web development, my favourite tool is Django. It comes as a fullstack
> framework which means I have everything I need out of the box. Templates,
> caching, ORM, a kick-ass autogenerated admin section, cross-domain request
> forgery protection etc. and the documentation is really top notch.
> I'd rather have Clojure than Python but all the goodness that Django
> provides is such a time saver that I feel I'd lose too much time with
> Clojure.
> If I had a full-stack, well-documented clojure framework, I'd jump to that.

Ditto. Django's admin tool is something I haven't seen elsewhere, and
it saves me gobs of time. I can't imagine switching to a framework
that doesn't have that. But hypothetically, if Clojure did have
something like that, I'd consider switching.

Another factor to me is the reality of webhosting. There are a number
of webhosting services (e.g., webfaction) that make it super-easy to
get Django, turbogears, cherrypy, rails, etc. up and running with
one-click installers and very detailed tutorials. On the other hand,
Java-based servers usually require much more knowledge to deploy, and
usually require more memory than the cheapest plans offer. I'd
probably be unlikely to switch to Clojure for webhosting without
detailed instructions on how to deploy on a well-known, inexpensive
hosting service (like webfaction).

James Reeves

unread,
Jun 25, 2010, 4:52:46 PM6/25/10
to clo...@googlegroups.com
I'd first like to thank everyone who has replied so far. Your feedback
has been invaluable.

I'm going to try and address some of the issues people have raised. If
I've missed any big ones, feel free to shout louder :)

@Joost
Could you send me an email with the i18n patches you had to make to
Compojure/Ring?

@Chas
I think we probably need a high-level way of exposing a type as a HTTP
resource. I haven't thought about this much, but it's certainly a hole
that isn't quite filled by currently available libraries.

@Chas, @Brian, @Brenton
Deployment is also an issue. Perhaps we need a Leiningen plugin that
would automatically generate an AOTed HttpServlet, given a :handler
key in defproject that designates the main handler function.

Another option is to bypass the whole idea of Java servlet containers
and devise some lightweight Clojure solution. I guess some people will
like that idea, whilst others will shudder at the idea of reinventing
a well-used wheel.

@Hugo
I agree that a standard authentication and authorization library would
be good. With OpenID, OpenAuth, etc. authentication is becoming quite
complex, and login pages are becoming quite uniform. It would be nice
to have some middleware that would automatically provide this sort of
thing.

Named routes may be something I could integrate into Compojure. I'd
have to think of a good way of doing it.

@Adrian
One thing Ring and Compojure are lacking are some good benchmarks.
I'll have to see about making some, unless anyone wants to volunteer?

@Jimmy, @Chas, @Sean
Websockets/Comet is something that has been mentioned to me a few
times. Websockets are a separate protocol to HTTP, and Comet is
essentially a separate protocol, even if it uses HTTP as a transport
layer. So in the past, my opinion is that normal HTTP should be
handled by Ring, and Websockets/Comet should be handled by something
different.

However, it occurs to me that whilst Websockets and Comet are arguably
not HTTP, they do start out with a normal-looking HTTP request. I
wonder if Ring could accept this initial request, but instead of
returning a standard response map, it returns a message-handling
function.

I'll think about this, then bring it up on the Ring group for further
discussion.

@Wilson, @Daniel, @Mark E
Clojure web development is shaping up to be made up of many small,
interchangeable parts. On the whole, I think this is a good thing. I
don't like the idea of monolithic web frameworks, continually
reinventing the same wheels (routes, templates, ORM). My goal for
Clojure web development is near total interoperability.

But at the same time, it's good to be able to pick something up that
integrates all these small parts together. I think eventually we'll
see larger frameworks emerging for Clojure that just tie a bunch of
low-level libraries together. But I think we're a little way off that
goal.

@Wilson, @Brenton, @j-g-faustus, @Brian, @pavelludiq
I've also started writing a Clojure Web Development book. One of the
problems of having lots of small libraries is that its hard to get an
overview of how one should proceed. The Clojure Web Development book
is an effort to take the reader through the Clojure web development
ecosystem, starting with Ring, but also later covering Compojure,
Hiccup, Enlive, Moustache, Sandbar and others.

I envision this as being similar to the Git community book
[http://book.git-scm.com/]. I've started a Google document for it,
which you can view here:

https://docs.google.com/Doc?docid=0AQqGP1CDN0uIZGhmZjJmcGZfMjNjNHIycGZu&hl=en

At the time of writing, it's in a ***very*** rough state. If anyone
wants to help me out, I'll send them a read-write link they can use to
contribute. When the book is more complete, I'll divide it up into web
pages and put it in a GitHub repository.

@Mark S
Logging is something I've been very interested in at various points in
the past, usually when an application goes wrong in production and I
have to figure out what went wrong!

I think we need to discard the notion that logs should be timestamped
strings outputted to a file. Instead, I think they should be hash-maps
we send to a logging server, which then stores them in a database.

You could then visit the database and say "Show me all exceptions that
occurred for user X". You could then select the field you wanted and
say "Show me all log messages that occurred within the context of the
same request as this exception". This is something that would have
saved me a lot of pain in the past.

You've gotten me thinking of writing something like this, perhaps
using MongoDB or Redis to store the documents, and Compojure to write
a nice web interface for searching/configuring.

@Martin
I've been thinking on and off about how to bind data to a set of
routes. I'll let you know if I come up with anything, and suggestions
are always welcome. I think Allen's "Turtles all the way down" post in
the Compojure group is thinking along the right lines.

@Howard
Exception reporting could be better, I think. Clojure in general tends
to have pretty tangled stacktraces, but perhaps that's just because
it's difficult to distinguish between my libraries and clojure.core
where the exception invariably bubbles up from.

Improvements to the Ring stacktrace middleware might help. Perhaps
also something that automatically logs stack traces.

@Mark E
Hosting facilities will probably improve in future, but I suspect
it'll be a while. I'd personally like something like Heroku, but I
don't think the demand is there to sustain a service like that.


I hope this reply was comprehensive enough. There are a lot of really
useful replies in this thread.

- James

Rick Moynihan

unread,
Jun 25, 2010, 5:42:18 PM6/25/10
to clo...@googlegroups.com
Hi James,

Great idea for a survey!

I'm using Clojure to bootstrap a startup, broadly in the Healthcare
domain. The system we're building comprises a number of components
all implemented in Clojure, one of which is a centralised web server.

The reason we chose Clojure was because it runs on the JVM, and we can
interact easily with lots of legacy systems (Java has the best API's
for interacting with the legacy systems we need). This coupled
equally with Clojure's strong DSL capabilities, and homoiconic syntax
(beyond just macros) are a key motivator for us. I doubt the things
we're doing would be achievable in Scala, Groovy or JRuby in the time
frames we need... Because Clojure seems naturally suited to our
domain problem.

Anyway, the point is that we're using Clojure for non-web reasons, but
have been pleasantly surprised by the web story as it stands...
Though right now (on the web) our needs are pretty basic.

On the web side, we're using Ring and Moustache. We were using
Compojure, but migrated to Moustache as I suspected Compojure was
giving us problems with Clojure 1.2 (which we need for incanter).
Anyway, the problem turned out to be unrelated to Compojure but the
work involved in migrating between Compojure and Moustache was only
about 30 minutes! So in this regard I think the component oriented
approach to web development is working, as you really can swap
components in and out quickly and easily... Something that I think
would be far harder in Ruby (even with Sinatra).

I'm on the fence in the Moustache vs Compojure debate. Both seem very
good. I like how Moustache is more Clojure like. But then I also
like how Compojure is more 'HTTP' like, i.e. it is more apparant that
Compojure is routing HTTP requests than with moustache... but I think
moustache is more flexible.

That said I have two issues with moustache:

1) There are too many equivalent syntactic forms. This can be
confusing, and I think I'd prefer the different syntaxes to have
different semantics.

2) Moustache seems to silently swallow errors... However I haven't
debugged this yet to firmly blame moustache, as it could well be my
code.

Anyway we're not firmly in Moustache camp and might later switch back
to Compojure if it's beneficial.

The web-app UI itself is written in Java as GWT application, that is
compiled into HTML CSS & Javascript, however we write the GWT-RPC
servlets in Clojure, and AOT compile them for wiring into jetty.

This combination works quite well, as we get a blindingly fast UX,
whilst retaining interactive development of both the ajax client and
server side... whilst not worrying too much about cross browser
issues. This said, I'm not completely sold on GWT yet, and we might
consider switching to something else if it proves more capable or
productive.

We use Moustache (and before it Compojure) for routing API style
requests rather than those from the webapp.

The most complex part of our web-application is really the jetty
wiring. Unfortunately because we want to mix both servlets (AOT
compiled GWT RPCServlets) and ring handlers, we can't use the ring
jetty wrapper.

This could be simple if ring provided a means of converting a servlet
into a handler (it already does the other way). This is the feature
I'd most like to see in ring.

We could of course wire the thing together in a web.xml, but IMHO
that's more pain than wiring it in Jetty. Besides, having a REPL
direct into the server is really handy, when you need to interogate
things.

Anyway, I'm *way* more productive in Clojure after a year and a half
than I ever was in Ruby (approx 3-4 years) and Java (more than I care
to count). I love how pragmatic the language is, and how you can
solve a complex problem in 5 lines of expressive code... Not to
mention interactive development, and paredit which makes life coding
way more fun than even Ruby was.

Oh, and also Clojure is fast!! Love it! ... Oh and did I mention how
great incanter is?! :-)

Anyway, thanks again for your devotion to the Clojure community!

R.


On 23 June 2010 22:23, James Reeves <weave...@googlemail.com> wrote:
> Hello there!
>
> Chas Emerick's recent "State of Clojure" survey [http://bit.ly/dtdAwb]
> indicated that a significant proportion of Clojure users are beginning
> to use Clojure for web development. A recent Hacker News posting
> [http://bit.ly/91Bu5J] seems to corroborate these results, with
> several Clojure-based web applications already out in the wild.
>
> As one of the main developers of Ring and Compojure, I'd be very
> interested to hear more about how people are using Clojure to build
> web apps. To this end, I have a few questions I'd like to quiz Clojure
> web developers about:
>
> 1. Have you written, or are you writing, a web application that uses
> Clojure? What does it do?
>
> 2. Which libraries or frameworks are you using? Which versions?
>
> 3. What made you choose Clojure to develop web applications in? What
> are the strengths of Clojure web development?
>
> 4. What do you think are the current weaknesses of web development in
> Clojure? What could be improved?
>
> 5. Anything else you want to comment on?
>
> Please reply to this thread with your answers, and thank you very much
> in advance for your time. I really appreciate any feedback you can
> provide.
>
> - James
>

MarkSwanson

unread,
Jun 25, 2010, 10:36:31 PM6/25/10
to Clojure
> @Mark S
> Logging is something I've been very interested in at various points in
> the past, usually when an application goes wrong in production and I
> have to figure out what went wrong!
>
> I think we need to discard the notion that logs should be timestamped

I still like timestamps even with per-user logging. Since each user
has its ownfile yyyy-mm-dd/userid the timestamp per line only needs to
contain HH:MM:SS.
Each day a new directory/file is created as needed. So log files don't
grow toolarge. Another thread removes dirs/files older than 30 days.

> strings outputted to a file. Instead, I think they should be hash-maps
> we send to a logging server, which then stores them in a database.

I prefer files. Using a DB prevents me from using existing powerful
tools to search and query the logs: vim and emacs.
The nice thing about per-user logging files is that they don't get
that big. They are quick to load/search/analyze.

> You could then visit the database and say "Show me all exceptions that
> occurred for user X". You could then select the field you wanted and
> say "Show me all log messages that occurred within the context of the
> same request as this exception". This is something that would have
> saved me a lot of pain in the past.

Wrt context: per-user logging data is written serially so it's easy to
figure out the context/progression of events that lead up to the
exception. You know where one request starts and ends.

FYI: we use the STM to queue up requests in a map and flush each
user's loggingdata to disk every few seconds.

James Reeves

unread,
Jun 26, 2010, 7:41:41 AM6/26/10
to clo...@googlegroups.com
On 26 June 2010 03:36, MarkSwanson <mark.sw...@gmail.com> wrote:
> I still like timestamps even with per-user logging.

Sorry, I guess wasn't entirely clear.

The maps would still contain timestamps. My point is that we should
get away from the idea thinking of logs as unstructured text strings.

For example, a typical log message for a web application might look
something like:

{:application "Some app"
:timestamp "20100626T112154Z"
:server-ip "10.23.1.34"
:request-uuid "885902e5-4fd0-43b3-b3d6-8961e8987278"
:session-user-id 102
:level "error"
:message "Inconsistent user data"
:stacktrace ["<line1>" "<line2>" ...]}

Something with lots of juicy information we can filter on, and
something that can be elegantly displayed in a web-based user
interface.

> I prefer files. Using a DB prevents me from using existing powerful
> tools to search and query the logs: vim and emacs.

Databases are usually quite good at querying information as well; that
is something they are designed to do, after all. I believe MongoDB has
support for regular expression searches, so there's not really
anything you can do with a text editor that you can't with a
sufficiently advanced database.

You also get more fine-grained control over storage. For instance, I
might want to have debugging messages expire after five days, but
error messages expire after three months. Or perhaps I want to blind
user information before exposing the logs to developers.

That said, any good logging library has support for multiple back
ends. If you didn't want to write out to a database, you could plug in
your own storage system that divides files up by user ID and date, and
then appends the log messages to a text file.

- James

Straszheim, Jeff

unread,
Jun 27, 2010, 3:33:28 PM6/27/10
to clo...@googlegroups.com

At Akamai we are using Clojure combined with Compojure for a project that involves the live transcoding of mobile content. I can't talk about the details, nor mention any specific libraries or features we are using, except to say that we chose Clojure for the normal reasons: its meta-programming and concurrency features. We are very happy with our decision to use Clojure.

(We're hiring for this project.)

Jeffrey Straszheim
Senior Software Engineer

spacer.gif
email_footer1.gif
ATT00001..txt
spacer.gif
ATT00002..txt
spacer.gif
ATT00003..txt

Timothy Washington

unread,
Jun 28, 2010, 12:19:35 AM6/28/10
to clo...@googlegroups.com
I am using clojure to rewrite an online bookkeeping application (currently only a test site). I have wanted to learn Lisp and functional programming for a while now. And the emergence of Clojure, and the need to refactor my application, gave me the opportunity.  

While I'm still new to the language and functional programming, the technical benefits of Clojure were immediately apparent to me. I think others will give a good listing of those technical advantages that Clojure offers. What struck me as I started to use it was how Clojure "feels". Specifically, when I had to redo some Java code in Clojure, it was just striking, the expressive power it gave me over Java. I haven't had this much fun programming since I designed my first language !! Anyways, this isn't a campfire :) The Bookkeeping's current stack is: 
  • Java / Servlets ( I'm going to try Compojure here ) 
  • a custom DSL using http://SableCC.org ( 'proxy' macro beautifully lets me incrementally implement only features I need ) 
  • custom XML Java binding framework ( http://repo.or.cz/w/Bob.git - Clojure negates the need for this ) 
  • A native XML database, eXist, with a RESTful access service 

Tim

Oleg

unread,
Jun 28, 2010, 9:48:25 AM6/28/10
to Clojure
1) Sure. I'm preparing financial and operational data analyzer now for
corporate usage. Some kind of BI/EPM application for specific needs.
2) Usually bleeding-edge or latest releases of following libraries:
- Compojure (thanks James for your great work)
- Hiccup
- Ring
- Oyako (thanks Brian for your ideas)
- scriptjure (want to replace my js with this generator)

3) Interactive development, fresh and fun to work with, hiccup-style
html generation.
4) Debugging in emacs with breakpoints and steps, better documentation
on some libraries, add record validation support in oyako.
I think that we need better persistency solution, as for me oyako
could be great base for it.

5) Thank you guys, for your work on making clojure better

- Oleg

Matt

unread,
Jun 29, 2010, 9:02:09 AM6/29/10
to Clojure
> If I had a full-stack, well-documented clojure framework, I'd jump to that.

Have you looked at Conjure? http://github.com/macourtney/Conjure

Docs: http://wiki.github.com/macourtney/Conjure/

It's not as fully featured as Django, but it's a good start and it's
in Clojure. Conjure doesn't have an autogenerated admin section, but
you can get some authentication and admin through the simple-
authentication plugin. Unfortunately, I haven't had time to update it
for the latest version of Conjure.

Matt

unread,
Jun 29, 2010, 9:20:08 AM6/29/10
to Clojure
> 1. Have you written, or are you writing, a web application that uses
> Clojure? What does it do?

We are currently writing a web interface for the project I'm on. The
project, IMSMA, keeps track of landmines in war-torn countries so
humanitarian efforts can clean them up. The main program is a java
swing application, but they wanted a stripped down web app for data
entry. Conjure was an obvious solution since it allowed us, through
Clojure, to reuse much of our code from the swing app and gave us a
very quick and easy way to build the web app.

> 2. Which libraries or frameworks are you using? Which versions?

We're using Conjure (of course). It's an older version, probably a 0.4
or 0.5, I'm not sure which. Unfortunately, Conjure has changed
drastically since then and would require a major rewrite of our code
to catch up. I may try to do that, but after our first release when I
have some time to refactor and clean up code.

> 3. What made you choose Clojure to develop web applications in? What
> are the strengths of Clojure web development?

One of the biggest strengths for us is the java interop of Clojure.
Without it we couldn't reuse much of our java code, and would have put
us way behind. We could have used JRuby, but we felt Clojure is a much
better language which allows us to write even less code to do what we
want.

> 4. What do you think are the current weaknesses of web development in
> Clojure? What could be improved?

Deployment has been a problem. I hacked together an installer for our
app, which sets up our Conjure app as a windows service. I'm thinking
of creating a Leiningen plugin for it, but it would require izPack
which is very hard to use.

We've also had some trouble with support with java script. It's there,
but we're doing some crazy stuff with it, and even JQuery is having a
hard time. I'm not sure what can be done there.

> 5. Anything else you want to comment on?

I see a lot of people asking about a full stack web framework, but not
finding Conjure for some reason. I understand for a good number of
people in the Clojure community, Compojure and supporting libraries
are what they want and need. However, Conjure does have a niche, and I
would like to see more people using it. Is there anything I should be
doing to get more people interested?

Matt

unread,
Jun 29, 2010, 9:25:05 AM6/29/10
to Clojure
Here's the Conjure scaffold controller in 4 lines:

(ns controllers.message-controller
(:use [conjure.controller.base])
(:require [controllers.template-controller :as template-
controller]))

(copy-actions :template)

And, you can still add any actions you want, or override the action
which are already there.

-Matt Courtney

On Jun 25, 10:33 am, Luc Préfontaine <lprefonta...@softaddicts.ca>
wrote:
> Were not using Clojure yet for our
> Web based GUIs.
> The main reason being that we jumped
> on Rails last year. Most of our needs
> are to display/edit database data and
> the ActiveScaffold plugin allows us
> to write a controller in 20 lines.
>
> We do not need to write forms,
> it's all done through partial renderings
> provided by the plugin.
>
> We just provide layouts and customize
> CSS stuf.
>
> We will give a closer look to
> Compojure this year and see if can
> achieve the same code ratio somehow.
>
> Luc P
>
> Sent from my iPod
>
Reply all
Reply to author
Forward
0 new messages