Adobe Solution Partner

January 21, 2008

Steve’s MVC Framework a year later

Filed under: ColdFusion, Fusebox — Tags: , , , — Steve Nelson @ 5:07 pm

A few people have asked me if I’ve done anything with my MVC framework that I presented a year ago at the CF Frameworks conference. The short answer. Yes, but very minor.

I admit it. I’m an addict. Mostly it’s the utter simplicity that I love. It takes the power of CFCs with the simplicity of Fusebox 1.0 (yes, the original Fusebox). Sure there are lots of little things you need to do when working with CFCs. But you have to do those with any framework that uses CFCs. What I like about this framework is that it’s about code organization, not extending some codebase or mastering yet another set of XML tags.

I’ll do a bunch of posts explaining what I’ve found. For those of you that don’t know what I’m talking about, let me see if i can explain a framework to you in one paragraph. I’d love to see if any other framework can do the same. So here we go (this is for an HTML app, Flex apps are a teeny bit different)…

Organize your code into 3 top level folders. “Controller” “Model” and “View” In each of those 3 folders contain subfolders. In each subfolder under the View folder contains a single CFC file and one or more CFM files. The methods in that CFC file do two things, deal with cfarguments and cfinclude one of the cfm files. These CFM files contain HTML code. The model folders are structured in a similar way. The model methods have cfarguments a cfinclude to a cfm (or put the code right in the cfc) and cfreturn some data. It is all tied together with the controller folders. These folders have a single CFC, each of the controller methods simply cfinvokes methods from the model and view cfcs. That’s it.

Ugggh, it sounds a lot more complex when I type it out. Wait! Let me try again!

Three groups of folders: Controller, Model, View. Each folder has a CFC and one or more CFMs. View methods cfinclude a display CFM file. Model methods cfinclude an action CFM file. Controller methods cfinvoke model and view methods. All web requests go to the controller CFCs first.

I like that definition better. If you want to try this out on one of your projects, I’ve posted some more info on it here. Or if you’d rather not mess around with framework theory and have us architect your next project, send us an email or give us a call at +1-970-223-2278

-Steve Nelson

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • StumbleUpon
  • Technorati
  • TwitThis

6 Comments »

  1. Steve,

    Sounds pretty similar to how the NOXML version of Fusebox 5.5 works.

    jb.

    Comment by JohnB — January 22, 2008 @ 12:00 am

  2. Haha. Who do you think pushed for that idea? :-)

    Comment by Steve Nelson — January 22, 2008 @ 12:00 am

  3. could you send me your framework sample code?

    Comment by matt — February 16, 2008 @ 12:00 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

 

Server Down?

Maximize Web application uptime by drawing upon Webapper's years of experience tuning and stabilizing many of the world's largest ColdFusion Web applications. Contact us today!