Thursday, April 7, 2011

New ColdFusion OSS Project Launched

In my last position I had some interactions with Ruby on Rails.  I was impressed by Rails and how quickly I could get a service tier up and running.  There were some things with setting up the Active Records that kinda irritated me though, and I could honestly care less about scaffolding.  Ever since that project I've been wishing I had something similar in ColdFusion.

Most of the applications I write anymore have a detached service tier and generally have a few different clients that hit those services.  More often than not I'm seeing the same methods over and over, and my mind returns to the stuff I saw in Ruby on Rails.  I've always been a big proponent of a RESTful interface, but at the same time I didn't always write my clients to utilize a RESTful interface.  I always created a bunch of methods that called similar a similar API though, like get(), put(), post() and delete().

Enter ColdFusion 9.  CF 9 provides CF ORM, a native implementation of Hibernate.  This allows us to do all sorts of cool stuff.  It permits us to provide common beans for each of our application objects.  Before, this would have to be completed with some mishmash of other techniques.

To that end I've created CFServant.  It serves two purposes.  The first is to create a bunch of generic service methods that allow you to stand up services for each of your CF ORM beans quickly.  By quickly I mean with two attributes added to your service CFC.  Instantly you'll have methods like get(), put() post() and delete().  The second purpose is to provide a remote proxy.  This proxy provides a remoting API that can be used from clients built in HTML and JavaScript (Ajax).  Any ORM bean you have a service defined for can now be accessed automatically by calling the getObjectName() method on the service proxy.  If I wanted to get all Users, I'd call getUsers().  Want a single user with the ID of 1?  Call getUser(1).  Everything is extensible so you aren't tied to the native implementation.

I plan on recording a video series on how this all works, but go check out the CFServant wiki for lots of information.

No comments:

Post a Comment