aspose file tools*
The moose likes Clojure and the fly likes New To Clojure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Languages » Clojure
Bookmark "New To Clojure" Watch "New To Clojure" New topic
Author

New To Clojure

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

I know that this question is answered many times, but still I have a lot more to know as I'm completely new to Clojure. First and foremost, how does this compare with Groovy? I mean both are dynamic scripting languages (Correct me if I'm wrong). I have an existing JEE project... would introducing Clojure bring any specific advantage. To put it in other words where would Clojure find it's place in my JEE project in benign ways?


SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
Sean Corfield
Ranch Hand

Joined: Feb 09, 2011
Posts: 231
    
    3

As I noted in my response in the Benefits of Learning Clojure thread, both Groovy and Clojure are intended to be general purpose and can be treated like dynamic scripting languages (although both actually compile down to JVM bytecode, just like Java and Scala etc). Groovy is really pretty similar to Java so many of Java's benefits and problems apply to Groovy as well. Clojure is very different to both languages because your approach is required to be entirely functional, with immutable data and operations over data taken as a whole.

I'm introducing Clojure into an existing project by replacing some low-level pieces so that they are easier to test and more amenable to safe concurrency. The higher level of expressiveness is providing some big gains in terms of code size, compared to the Java equivalent, especially where we need to work with collections of data.

We're also using Scala for some low-level infrastructure pieces, mostly where we have heavy manipulation of XML (since XML is a first class syntactic and semantic data type in Scala). Scala has proved very robust as a "better Java" for us but we find Clojure more approachable for general use so we're increasing our use of Clojure but probably won't increase our use of Scala very much. If Clojure didn't exist, we'd probably be using Scala more heavily.

As an example of how we're using Clojure instead of Java (or other languages) in a Java environment, take a look at my blog post on using Clojure with log4j. We're also gradually routing all of our persistence thru Clojure so that we can easily switch between MySQL and MongoDB - since Clojure's wrappers around both of those operate on maps of data and will therefore look identical to the rest of our application, with minimal effort. Clojure's ability to manipulate collections of data means we can also do interesting things in consistent ways across results from both types of data store.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: New To Clojure
 
Similar Threads
What's new in "Clojure in Action"?
JEE Enterprise Market scenario and Clojure
How are you using Clojure?
Productive and promising langauge out of the seven languages
Benefits of Learning Clojure?