An Architect's View

CFML, Clojure, Software Design, Frameworks and more...

An Architect's View

Entries for month: June 2011

Polyglot projects?

June 23, 2011 ·

In the LinkedIn ColdFusion Groups I recently asked the following question:

For the last three or four years, my CFML projects have general had other languages mixed in on the backend (Groovy, Scala, Clojure). I was wondering how many other people are leveraging the Java/JVM interoperability in CFML to take advantage of other languages?

What sorts of things have you done and why?

And if not, why not?

Several folks replied that they either didn't use other languages with CFML or they use a bit of Java. Several people also asked me to explain why I chose those other languages and how I integrated them with CFML. I replied to the group at some length but today on Twitter Aaron Greenlee asked me the same question and encouraged me to blog it for everyone to read. So, here it is...

[

Tags: coldfusion · clojure · groovy · scala

CongoMongo & Clojure 1.3.0

June 10, 2011 ·

CongoMongo is a Clojure wrapper around the MongoDB Java driver. It makes it pretty easy to interact with MongoDB:

(use 'somnium.congomongo)
;; connect to "example" database via mongo1:27017 or
;; mongo2:25017 seed hosts (I have a replica set running)
(def db (make-connection :example
    { :host "mongo1" } { :host "mongo2" :port 25017 } ))
;; insert a document into the "clojure" collection:
(with-mongo db
  (insert! :clojure
    {:name "Clojure" :tagline "The language from the future."}))
;; fetch one document from the "clojure" collection:
(with-mongo db (fetch-one :clojure))
;; you'll get back something like:
{:_id #<ObjectId 4df296940c2851a1d360ec10>,
  :name "Clojure",
  :tagline "The language from the future."}

Unfortunately for me, CongoMongo only worked with Clojure 1.2.1 due to dependencies on Clojure Contrib 1.2.0 - which won't run on Clojure 1.3.0. At World Singles we're relying on quite a few things in the alpha releases of "Clojure.Next" so, after talking to the CongoMongo team, I set about making it compatible with Clojure 1.3.0-alpha8. If you're using Clojure 1.3.0 and want to work with MongoDB, you should be able to clone the github repo for CongoMongo and run lein install to put a JAR into your local maven repository. Then you can add [congomongo "0.1.5-SNAPSHOT"] to your project's project.clj and you should be good to go! (Updated 6/29: CongoMongo has been updated on Clojars so you can get the version with 1.3.0 compatibility more easily)

Tags: mongodb · clojure

Adventures in MongoDB, Part 2

June 09, 2011 ·

After my early exposure to MongoDB at the MongoSF conference on May 24th, it has come time to start exploring MongoDB more seriously. After dealing with several other database solutions, I was pleasantly surprised at how accessible the MongoDB documentation is! My target was to set up a small production-like cluster to test replication and failover.

[

Tags: mongodb

Scala Days 2011 - Fascinating but...

June 04, 2011 ·

It's been a long time since I've been to a conference where serious research papers were presented. Pretty much every conference I've been to in the last 10-15 years has focused on practical use cases even for very bleeding edge topics. Scala Days had a mixture of practical and research but, at least based on the talks I chose, seemed very heavy on research - in several talks I felt like I was back at university in my final year computer science classes. It was all very interesting and thought-provoking / stimulating but I didn't come away fired up with new ideas I could apply at work. I did come away with a list of research papers to read tho'...

[

Tags: scala