Transfer object without the DB

There was an interesting post by John K yesterday on the Transfer-dev list, where he was asking about creating a transfer object that had no database behind it.  Basically, define the object in XML and then use the get / set methods to persist data around in a nice auto-generated cfc 9one of the things that Transfer is do good at).  There was some discussion whether Transfer would let you do this or not, so I had to give it a shot.  Turns out, you can define your object without any database and it works fine!

This started my brain going, you could define decorators against your objects, and use those to email a contact form that gets populated to your transient bean.  I think its kinda a slick way of making objects, and it would certainly be simpler to define the XML properties than creating a new cfc with get / set methods.  Anyone see any downfalls?

Digg StumbleUpon Facebook Technorati Fav newsvine reddit FARK Google Bookmarks
  1. Oscar Arevalo

    #1 by Oscar Arevalo - November 19, 2008 at 11:43 AM

    I use a similar approach in my ColdBricks CMS (although I don't use Transfer per se). ColdBricks uses its own library to produce DAOs that the upper layers of the application use to persist/access data. By default the application data is persisted in XML documents instead of a database. The main benefit is that you can just deploy the application and get it running right away without requiring to setup a database before-hand (or even needing one at all). This is great when you want to distribute a software for evaluation/demo only; and the fact that your library can indistinctly talk to DBs or XML persistent data, makes it a lot easier to migrate to a full DB backend whenever you need to.

Comments are closed.