• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

New To Clojure

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Rancher
Posts: 379
22
Mac OS X Monad Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks!
 
This looks like a job for .... legal tender! It says so right in this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic