Go nuclear with Reactor for Coldfusion

I’m sure, like me you get extremely bored of doing add,edit,delete,add,edit,delete,add,edit,delete. Well i’ve always been looking for a quicker way to develop this sort of code, yes you can create templates where you just fill in all the variables, but more often than not you end up re-writing the whole thing anyway. Well finally, bingo!  i’ve found out what i was trying to do is called an “Inline Dynamic Database Abstraction” API.  The API is called the reactor framework. It basically allows you to create a table in your database and from that table you can perform all your database queries on-the-fly.  Another great feature is that you can create relationships between tables via a simple XML file with this easy syntax:

  <object name=”mRegion”>
   <hasMany name=”sys_countries”>
    <link name=”mRegionCountry” />
   </hasMany>
  </object>
    
  <object name=”sys_countries”>
   <hasMany name=”mRegion”>
    <link name=”mRegionCountry” />
   </hasMany>
  </object>

  <object name=”mRegionCountry”>
  
   <hasOne name=”sys_countries”>
    <relate from=”country_id” to=”country_id” />
   </hasOne>
   
   <hasOne name=”mRegion”>
    <relate from=”regionID” to=”regionID” />
   </hasOne>
   
  </object>

This bit of code basically says a region has many countries and they link via a table called mRegionCountry.

It’s a lot more powerful than this but so far this as deep as i’ve gone. I’ve started using it in one of my applications and so far it’s saved me bags of time. I won’t go into details but after lots of googling i’ve found some very good documents the Introduction to Reactor for Coldfusion is great starter guide and is explained very simply with good examples. Also the .doc file that comes with the download is very good. Take a look at the examples too.

I’ll be posting more code in the future as I go along.

Advertisement

December 12, 2008. 'OO' Programming, coldfusion, Reactor Framework.

2 Comments

  1. Helgi Hrafn Gunnarsson replied:

    I must strongly advise against using the Reactor framework. It creates far more problems than it solves. SQL is one of the easiest and simplest language ever developed in the software world and there is no need to abstract it to the point that Reactor does.

    For over two decades now, all operating systems worth using in the first place have supported copy/paste. The “problem” of having to add CRUD functionality is nothing compared to maintaining a piece of software utilizing the Reactor framework.

    I guarantee you that by using it, you will waste more time than you will save.

  2. cfdev replied:

    I agree, since posting that, I have found better ways of working, I still think that having to write add,edit,delete is extremely boring and time consuming, i think this sort of functionality would be better as a plugin / wizard for eclipse.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Trackback URI

Follow

Get every new post delivered to your Inbox.