Ask a Jedi: MVC too much work?

This post is more than 2 years old.

Darren asks:

I've been doing some reading into design patterns specifically mvc, it all started as I got into flex, it all seems a bit scary as well , i've never thought about it for coldfusion and as I come from a design/flash background i've never had any formal programming training, i'm just self taught. I guess i can see the benefits of code reuse but it seems alot of work for normal websites, where do you sit on the issue, do you use design patterns at all. Do you think its worth learning, most of the time I work on my own or with one other person so I don't have large development teams to worry about.

I don't know Darren - can't we discuss something less controversial like politics or religion? ;)

This comes up from time to time in discussions of using a framework. Obviously if you are building a guest book (remember those?) a framework may be overkill. But one thing to keep in mind is that - at least in my experience - very few projects move from complexity to simplicity. Most projects start simple and grow in complexity. With that in mind - I tend to always use a framework like Model-Glue to help me manage the complexity.

I'm very much pro-framework for this reason alone. Having the framework help me organize and set up my application means I'm thinking less about crap and more about business logic.

So to focus on 'is it worth it for normal web sites', I'd say absolutely yes. Is it worth it for a 2 page application on a brochure-ware site? Nope.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by matt posted on 3/26/2008 at 8:57 PM

well said.
I like fusebox myself, sites grow fast when ya can see what code exists

Comment 2 by Nathan Mische posted on 3/26/2008 at 9:12 PM

I'm about to get into Flex as well and would like to know if an MVC CF framework like Model-Glue, Fusebox, or Mach-ii really work well for Flex. It seems to me that your controller and view would live in Flex, so I'm not sure what a full MVC CF framework gives you, other than added complexity. Again, I haven't done any Flex work yet so I could be missing something.

I should say that I am a huge proponent of MVC frameworks for HTML based web applicaitons, and while I do see the benefit of an IOC framework like ColdSpring, I'm not sure I see the benefit of an MVC CF framework behind a Flex app. Any insight would be greatly appreciated.

Comment 3 by David Buhler posted on 3/26/2008 at 9:57 PM


We have a Flex Application that acts as our content management system for our customers.

On the Search Engine Friendly side of things, we display the content added through the Flex Admin in CFML.

On the Flex side, we used Cairngorm as our MVC.
On the CF side, we found that we needed some small framework to manage the ever growing complexity of the code. It was easier for us to roll our own, because there weren't enough views to warrant a full MVC framework, but there's enough logic to warrant an organizational structure that saves time moving forward (using cfsavecontent pretty extensively).

So, here's my 2 cents:
If you're using nothing more than CFCs for the Flex application, consider strongly a Domain Model. A basic domain model that emulates the hierarchy of your viewstacks in Flex is a good place to start. This kind of organizational structure helps.

If you're using Flex to generate content that is part of a large CMFL system, a standard MVC framework may be very useful.

If you have a couple of pages of content, some contact forms, and a few display pages in CFML, I'd suggest creating your own micro-framework that focuses more on separating logic from layout, and creating complex layouts through smarter and more encapsulated CFCs. You'll also find that you can create more Search Engine Friendly URLs with a homegrown framework, and there's less processing overhead that may be beneficial when it comes to speed (and subsequently, the Search Engine Benefits of fast load times).

I believe Fusebox and Model Glue allow easier integration with Flex Remoting calls, and Model Glue has an example showing the Flex MVC and CF MVC frameworks together.

Comment 4 by Jeff posted on 3/26/2008 at 10:12 PM

I am very pro Fusebox-XML/MVC. Even for the brochure websites. They always want to add a contact form, comments, catalog etc. And you have a great framework to build on when they call and say, "Wouldn't it be nice if...."

It's a little more work up front, but it saves tons of time in the long run.

Comment 5 by Nathan Mische posted on 3/26/2008 at 10:19 PM

@David - Thanks for the input. I can see where, if you were using Flex as part of a larger system which included HTML views, a CF MVC framework would be very useful.

Comment 6 by David Buhler posted on 3/26/2008 at 10:47 PM

@ Jeff,

We built our contact form in Flex using the Cairngorm MVC. The benefit is that we could resuse the same form validation, services, regex, etc, as the monster Flex apps.

We used our own homegrown CF framework for populating the Object/Embed/History Manager/JS code because many of our pages use little Flex widgets.

In the future, I think you'll see more robust CF frameworks that are used to serve up Flex and Ajax systems with fewer views, more JS files, and help to create greater structure of the business logic with a completely different take on the "V" from "MVC."

Comment 7 by Jeff posted on 3/26/2008 at 11:05 PM


I agree :) , I just haven't taken the plunge into Flex yet. All of our sites are AJAX/HTML for the most part and they work great with FUSEBOX. When I do start our FLEX stuff I will definitely look into Cairngorm (I have read about it already).

Isn't there a Model-Glue flex framework also?

Comment 8 by David Buhler posted on 3/26/2008 at 11:09 PM


There is a Model Glue framework for Flex that provides an example of using MG for Flex with MG for CF.

sidenote: I'd like to see the CF Frameworks take a slightly more aggressive role in separating out some of the logic required to use the Ajax frameworks.

Comment 9 by Kris Brixon posted on 3/27/2008 at 4:16 PM

Although I like and use Fusebox, most programmers that don't blog also don't use frameworks. I would recommend at the very least to separate the display code/logic from the business/data code/logic.

For ColdFusion, I will require a minimum of not having SQL in the same file as HTML. Once you can break that cycle, moving up to a framework or MVC gets much easier.

Comment 10 by Chris Vigliotti (hibiscusroto) posted on 3/28/2008 at 7:40 PM

I second David's thoughts on creating your own framework...although I try to stay away from putting layout elements in cfcs (choosing to use custom tags).

Comment 11 by Raymond Camden posted on 3/28/2008 at 7:46 PM

@Chris: Not so sure I'd agree with that. One of the benefits of using a 'known' framework is that if you had to add/modify staff, it is easier for the person to come in and get to work. Obviously a company can teach their own custom framework, but with using an existing one, there is a greater chance of hiring someone who already know its.

Comment 12 by Chris Vigliotti (hibiscusroto) posted on 3/28/2008 at 8:07 PM

@ Ray: I see your point & have been in a situation where I've had to deal with a massive home-grown framework in the past. Needless to say it was a mess. Now if it had been properly commented/documented, better organized and consistently coded I'd be telling another story.

One last point...the "known frameworks" were once unknown frameworks. I should write a song about that.

Comment 13 by Raymond Camden posted on 3/28/2008 at 8:15 PM

@CHris: True - I didn't mean to imply that folks shouldn't make new frameworks - but....

a) An existing framework has the benefit of having been tested in the real world (most likely)
b) Before you re-invent the wheel, maybe you can modify an existing framework
c) There is a difference between having a home grown framework no one knows about and a framework you share with the world, get feedback on, etc.

Comment 14 by Indra posted on 10/22/2008 at 2:52 AM

Hi, I am new to ColdFusion for that matter to programming. I am developing an application for which I want to use coldFusion 8 and also want to follow MVC design pattern. Could you please suggest me any good CF MVC framework which is easy to work with. My application mainly concentrates on retriving the information from the DB and displaying.

Comment 15 by Raymond Camden posted on 10/22/2008 at 5:41 AM

Well I'd recommend Model-Glue, but you may also want to look at ColdBox, Fusebox, Mach II, and any other CF framework I may have forgotten. :)

Comment 16 by Bri Garrett posted on 7/22/2011 at 11:59 PM

Ray, I have been having nightmares about MVC for a month now. It is a BRICK WALL in my path of learning. I struggle because I want to "do it myself" first and then use a framework. I hate using things blindly. Yes, I do know how coldfusion works...and I can use it fairly well. Right now I'm actually trying to create some sort of design pattern to clean up some of my applications. This is where I started seeing MVC come up A LOT. What do you suggest I do? Do you know of any books/ sites that go really in depth on programming a MVC? (general rules and what not...)

Comment 17 by Raymond Camden posted on 7/25/2011 at 3:51 PM

I'd maybe consider the Head First Design Patterns book:

And don't forget Matt Gifford's OO in ColdFusion book: