I’m a Richardson, RU?

05 Dec, 2005

A roadmap for MG based OOC development

Posted by: imarichardson In: Programming & Development| Tutorials & Training

So in trying to catalogue my (in)experience with Model Glue, ChiliBeans, Arf!, and bunches of a whole lot of stuff centered around this OOC phenomenon I elected to try and create a guide for myself in understanding and siphoning through all the everything. As a disclaimer, I don’t profess to be the world’s greatest resource on MG, Beans, OOC, or Arf! at all — I’m just trying to find my way through. If it’s something you find to be incorrect, just comment (constructively, please … I’m so sensitive) and let me know.

Here goes …

  1. First you’ll need to get a understanding of Model Glue. Download the application and install it into your webroot as per the instructions. If it doesn’t work “out the box” you’ll need to create a CF Mapping in your CFAdmin for “ModelGlue” and everything should work without a hitch.
  2. Now it’s installed, run through the QuickStart examples. It’s really easy to follow and will give you a basic rundown of what MG exactly is and how the main components of the framework operate.
  3. Once finished you can also use Eddie Awad’s MG FAQ as a reference.
  4. After the quickstart, I found myself wanting to now work on some “real” application specific operations, say like connecting to databases and getting information to place in queries. Well, if you haven’t already done so, sign up for the Topica Mailing list for ModelGlue. It was there that I came across a thread dealing with this very issue by Stephen Adams.
    • Sam Clement gives a very good explanation of how to use beans to encapsulate properties and methods for getting and setting values (think of them as database table columns); using Data Access Objects (DOAs) for CRUD (Create, Read, Update, Delete) actions; and gateway objects, for handling queries and moving from say one record to the next.
    • He did such a good job, that I asked him to further explanation while giving examples of a sample Address.cfc, and DAO. In reading his response, he mentions an online bean generator in which you simply enter the properties (really just the db table columns) and a bean (ColdFusion bean, that is) is automagically generated for you. (You need to hands down save that URL at all costs!!!) He also mentions that to see DAO, gateways, etc. in action you can visit Phil Cruz’s Mach-II Info Exchange and view the sample application.
    • Phil offered an even further explanation of how you can even specify default values and data types for the generator in an additional response.
  5. Next comes the issue with security. Any good CF application has to implement some kind of security mechanism. For this I’ve looked at Jared Rypka-Hauer’s MG Tutorial posting on Tiered Events Using ModelGlue. Also, Chris Scott (among many others discussing in the MG Topica List) mentioned in a post that he may be doing a write up on a security controller.
  6. Now it’s probably a good idea to get a handle on “ConfigBeans” based on a tool called ChiliBeans written by Joe Rinehart. Why ConfigBeans? MG actually uses these things internally and you can use them too. Instead of having methods going back and forth for common config values (everything from variables, to complex arrays and structures) you use config beans for these “things”. The posting “examplizes” (yes, I made up the word) internationalization of of two settings for time and date formats.
  7. Wanna really mess yourself up? Check out Arf! (another great reality from Joe Rinehart) . (No, that’s not bad punctuation - the “!” is part of the name.) For anyone even remotely familiar with the ActiveRecord framework for RubyOnRails, this is an newly designed implementation for ColdFusion. All I can say is imagine the magic behind creating a component, naming it the same as a database table, and automatically having CRUD functions, validation, internationalization, and much more available programmatically. Yes, I may be a bit “over simplifying”, but these capabilities become available very easily! It’s still in it’s infancy but is looking really good. You can download the API here. There are also a few really good videos for viewing that help get your mind around Arf! (vid1, vid2, vid3). It seems at first independent from MG, but there was buzz from a few comments about integration … from first glance it doesn’t seem like there is even an issue with integration. You pretty much just add the files to your root and run. (You can check out this Breeze presentation from Jared Rypka-Hauer, too.)
  8. OK, so now I’m gonna branch completely out and almost into another framework … well, I actually am going into another framework - CFWheels.com’s CFonWheels by Rob Cameron. You had to know this one was coming — hey, I said that before. There’s a video and some good documentation, as well.
  9. Where to go next? Coldspring - so I haven’t looked a total lot into it yet, primarily because it seems mostly like everything ties into Mach-II, but there is a ModelGlueAdapter in the works. Also, here’s a posting on how to integrate from an MG perspective. From my understanding it provides some of the same functionality as ConfigBeans, and a few other functions, as well.

That’s it … I’ll probably need to come back later and review/update info, but I’m hoping it can help someone; at least it’ll help me.

No Responses to "A roadmap for MG based OOC development"

Comment Form

You must be logged in to post a comment.

I'mARichardson Who?

Who am I? Well, let's see: I'm a husband, father, brother, God-father, down to earth, relaxed, happy kinda guy who likes clean code, long walks on the beach, takes his laptop with him everywhere he goes, and (as I'd like to think) all around good guy!