Report: ColdSpring and Model-Glue Unity @ UKCFUG
Last night I went into London to watch Mark Drews presentation at the UKCFUG on ColdSpring and Model-Glue Unity.
Mark Drew will be demonstrating the Coldspring framework and how it works within the Model Glue framework, allowing your CFC's to be wired together using an Inversion of Control pattern.
Before we stated Mark said that his presentation was going to be quick... hand on, was he not about to start talking about coldsrping (CS) and MG? Surely CS was a massive topic in in itself let alone MGU. Well I think that was the best things I took away from the meeting. Actually they are very powerful frameworks but yet they aren't over complicated. Yes they can be very complicated if you wish to get into the bowels of the beasts but the great thing is you don't have, to get them up and running is not that hard. What we learnt was basic but it did show of the power of each framework.
So what is Coldspring?
ColdSpring is a framework for CFCs (ColdFusion Components). ColdSpring's core focus is to make the configuration and dependencies of your CFCs easier to manage. ColdSpring uses the "inversion-of-control" pattern to "wire" your CFCs together. Inversion-of-control provides many advantages over traditional approaches to assembling your application's model. Also part of ColdSpring is the first Aspect-Oriented-Programming (AOP) framework for CFCs. To read more about ColdSpring's functionality, head over to the Documentation section of this [coldspring] site.
Great so what does this mean? Imagine for a second (and I try not to use Marks example here) that you have an object that deals with all your company contacts. A component does something like getContacts. In this object you have a call to another object called get Address. Great that works fine you have the following code in server components that need to get a employees address:
<cfargument name="memberID" type="numeric" ...>
<cfset var memberBasics = CreateObject("component", "cfc.users.basics") />
<cfset variables.memberAddress = memberBasics.getaddress(arguments.memberID) />
<cfreturn this />
</cffunction>
Now supposing that you make a change the location of the address CFC . You would then have to update all you other components that invoke the address CFC – a real pain. This is where CS helps as it allows you to pass in your methods into the components as arguments. Example:
<cfargument name="memberID" type="numeric" ...>
<cfargument name="memberBasics" type="memberBasic" ...>
<cfset variables. memberAdress = arguments.memberBasics.getaddress(arguments.memberID) />
<cfreturn this />
</cffunction>
So any changes that have you have made to the location of the CFC only needs to be update in one location, the rest of the code won't be affected.
This is a very basic example but hopefully one that shows what can be done. Chris Scott has some great examples of AOP with CS – check out his blog for more information One of the great things Mark showed us was that CS can include a dynamic xml data variable that one can pass to the bean factory finalisation using cfsavecontent or if you want to via an xml file – he did suggest that you validate the xml first, which would make sense.
So what is Model-Glue Unity
Model-Glue helps you build Object-Oriented ColdFusion applications based on the Model View Controller pattern. It's designed to be easy to use and play well with others, like Tartan.
The scaffolding which is included within MGU looks great – not only will it save you needless task when creating pages but the forms that it create can be customised via XSLT. This means that if you don't like how the scaffolding creates the pages, then change it. Another great feature is that can plug in action pack. Okay so what are .
wouldn't it be nice to write a forum app, and then just say "add this to my Model-Glue application? Well, there's a new tag in Model-Glue:Unity that allows just this: < include> as a child of
So for examples if I had an news segment/application that I wanted to use on multiple sites I could include it like:
Simple huh.
This addition means that any ModelGlue.xml file can other ModelGlue.xml-format files, and that the "child" files can declare their ownand .
DRY philosophy or what.
If you've not tried out unity yet then you must it's a great looking app – I'm building my next application with it, watch this space.
Please share any experiences or links in the comments.
Andy Jarret has a nice post at his blog.
Marks presentation slides can be found on his post





There are no comments for this entry.
[Add Comment]