aspose file tools*
The moose likes Clojure and the fly likes When to use Clojure ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Clojure
Bookmark "When to use Clojure ?" Watch "When to use Clojure ?" New topic
Author

When to use Clojure ?

Jan Goyvaerts
Ranch Hand

Joined: Feb 08, 2011
Posts: 32
I am 99% of the time designing and developing commercial, administrative, ... software. Very rarely in an academic context.

Are there typical cases/problems/... that Clojure excels at in a business software context ? Compared to Java for example.

Jan
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

I may not be able to address your question but I have comment:
Clojure isn't about Academic studies (of course it can be), what is nice about Clojure is being a practical Lisp.
More friendly syntactic sugar, mind-blowing concurrency support, running on the JVM (massive selling point).
ITA software wrote their Airline Reservation System for Air Canada with Lisp (Clozure CL).
Chris Houser
author
Greenhorn

Joined: Feb 07, 2011
Posts: 22

As John said above, Clojure is not an academic language. I feel confident saying this for a couple reasons. One is that it makes no claim that any one aspect of it is new or unique enough to be interesting "academically". Another is that in studying the decisions made in the design of Clojure itself, one can see that time after time when given the choice between something clever or unique on the one hand, and something useful or practical on the other, Clojure invariably goes with the practical solution.

For why Clojure might be worth learning and using, see my answer to question 2 over there.
Sean Corfield
Ranch Hand

Joined: Feb 09, 2011
Posts: 267
    
    5

FWIW, I'm starting to use Clojure for parts of a large, complex web application (an Internet dating platform, in fact). We're adopting it for a number of reasons:

Immutable data structures make correctness / testing easier and remove concurrency issues.

Small, pure functions also make correctness / testing easier.

Lazy collections allow us to manipulate large data sets in interesting ways.

Higher order functions allow us to combine small, well-tested pieces of functionality in interesting ways, improving reuse and reducing the overall code size.

Our Clojure code is generally very concise (certainly compared to Java) and usually easier to understand.

We also work with Scala and CFML. We use Scala for performance-intensive heavy lifting on the server (e.g., transformation and publishing of large data sets as XML). We use CFML for the View-Controller portions of our application, running on Railo, the JBoss community project that provides a fast, free, open source CFML engine.
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Sean Corfield wrote:
We also work with Scala and CFML. We use Scala for performance-intensive heavy lifting on the server (e.g., transformation and publishing of large data sets as XML). We use CFML for the View-Controller portions of our application, running on Railo, the JBoss community project that provides a fast, free, open source CFML engine.

To gain more performance, have you tried to use types hints in Clojure before you go with Scala route?
Sean Corfield
Ranch Hand

Joined: Feb 09, 2011
Posts: 267
    
    5

We started using Scala before we looked at Clojure. Yes, we are using type hints in Clojure where it matters - and we are using 1.3.0 alphas to take advantage of the enhanced primitive support.

I'm not saying we chose Scala over Clojure for performance. We're using Scala for low-level infrastructure that doesn't change much, leveraging the strict type system for correctness and the actor model for concurrency.

We're using Clojure for its dynamic nature, in parts of the app that change frequently, where a more test driven, more malleable approach helps us move quicker.

In other words, we're using Scala where we probably would have used Java and we're starting to use Clojure where we would have used CFML (but need more reuse across layers).
 
Consider Paul's rocket mass heater.
 
subject: When to use Clojure ?