Griffon gets some Clojure - No Fluff Just Stuff

Griffon gets some Clojure

Posted by: Andres Almiray on July 30, 2009

I'm happy to report that Clojure, a dynamic programming language that targets the Java Virtual Machine, can now be used on a Griffon application thanks to its brand new Clojure plugin. This brings the count of supported languages (either directly or via plugins) up to five, Java and Groovy being the first two, followed by Scala and JavaFX.

So what's the deal with Clojure? it's main page gives a few hints:
Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy and a powerful macro system. Clojure is predominantly a functional programming language, and features a rich set of immutable, persistent data structures. When mutable state is needed, Clojure offers a software transactional memory system and reactive Agent system that ensure clean, correct, multithreaded designs.

The incentive of building this plugin came after receiving news of Grails getting its own Clojure plugin. The Grails plugin has no ties to the Servlet API which makes it a perfect candidate to be ported to Griffon, however its current implementation lets you load any Clojure script and execute it. While this behavior can be replicated in Griffon using a combination of build and runtime events (like it is shown by the grojure sample application), it would be best to provide that behavior with a runtime plugin, in other words, loading Clojure scripts must wait until the addon feature is published (coming in Griffon's next point release, that is 0.2). In the meantime, you will be able to compile Clojure sources that are intended to generate a compatible Java class, those classes in turn can be called from your Java/Groovy classes. This means you are now able to write "business layer" logic in Clojure!

There are no plans in enabling members of the MVC group to be written with Clojure (or Scala or JavaFX) for now, the point of these plugins is to enable polyglot programming, harness the strengths and unique features of each language where they make sense.

Keep on Groovying!
Andres Almiray

About Andres Almiray

Andres is a Java/Groovy developer and a Java Champion with more than 20 years of experience in software design and development. He has been involved in web and desktop application development since the early days of Java. Andres is a true believer in open source and has participated on popular projects like Groovy, Griffon, and DbUnit, as well as starting his own projects (Json-lib, EZMorph, GraphicsBuilder, JideBuilder). Founding member of the Griffon framework and Hackergarten community event. https://ch.linkedin.com/in/aalmiray

Why Attend the NFJS Tour?

  • » Cutting-Edge Technologies
  • » Agile Practices
  • » Peer Exchange

Current Topics:

  • Languages on the JVM: Scala, Groovy, Clojure
  • Enterprise Java
  • Core Java, Java 8
  • Agility
  • Testing: Geb, Spock, Easyb
  • REST
  • NoSQL: MongoDB, Cassandra
  • Hadoop
  • Spring 4
  • Cloud
  • Automation Tools: Gradle, Git, Jenkins, Sonar
  • HTML5, CSS3, AngularJS, jQuery, Usability
  • Mobile Apps - iPhone and Android
  • More...
Learn More »