Objects and Frameworks - The Right Framework

Posted on Aug 09, 2006

Inevitably when discussing getting started with frameworks, the question comes up, "Which framework should I choose?" Well, let's answer that.

You see, many years ago 4 frameworks were created and given to the gurus of ColdFusion OO. Then forged in the depths of Mordor was created the one framework to rule them all; one framework that could unleash the full power of ColdFusion. That framework was called...So let's get realistic, there is no one correct framework. Peter Farrell and Matt Woodward had a small debate about frameworks on the ColdFusion Weekly and they said that people tend to pick a framework as a roll of the dice of sorts. They advocated what sounded like an extensive review of framework features. While that may have its benefits, a lot of the stuff they mentioned is likely beyond the consideration of someone new to objects and frameworks.

To me, choosing a framework in ColdFusion when you are new to objects and frameworks is a bit like being someone who has never eaten Mexican (ok...actually Tex-Mex if you want to be picky) and goes into a Mexican restaurant. He turns to his buddy and says, "So what is a taco?" His buddy says, "It's a tortilla with meat or chicken, cheese and other toppings of your choice." "So what s a quesadilla?" "It's a tortilla with meat or chicken, cheese and other toppings of your choice." "So what is a burrito?" Well, you get the picture right?

So, what is Fusebox? It is an Model-View-Controller framework configured through an xml config file. So what is Model-Glue? It is an Model-View-Controller framework configured through an xml config file. So what is Mach-II or ColdBox? It is an Model-View-Controller framework configured through an xml config file. Now obviously this is extremely oversimplifying, but as a noob, that is basically what it looked like to me.

So, am I saying it doesn't matter which framework you choose? No, not at all. It mattered enough to me to make a switch in the end. Ultimately, I switched from Model-Glue to Mach-II because I like that Mach-II makes you declare everything explicitly - much like driving a stick shift (which I do), I like the control it offers. I still like Model-Glue - and driving automatic is nice in traffic.

There are other reasons I made the choice specifically dealing with features, but to be honest, when I started I just picked one. The specific differences between the frameworks (and I am not intentionally excluding Fusebox and ColdBox from my discussion, but I am not very experienced with those) became much clearer when I had some experience using one.

So, I guess its my opinion that its ok just to choose one and go with it. Its also totally ok to change your mind and switch later on. I think the best bet is to start with a side project, a small(ish) one and not to start redoing your company's main site architecture with your first choice framework (uh...made that mistake). Nonetheless, the good news is that (if you do it right - which admittedly is tough the first time around) swapping out frameworks isn't really that difficult.

My suggestion is, read a little about them and pick the one that strikes you. However, when you are more comfortable with the concepts involved in using objects and frameworks, feel free to revisit the topic. You may be surprised that your feelings have changed - or maybe you will find that you made the right choice the first time around.

So, for now this was the last post on my objects and frameworks. Sorry it was a bit delayed, but to be honest this is a bit of a touchy topic - people feel very strongly about their favorite framework. Hopefully this helps you find yours.

Comments

Sami Hoda Well said Brian.

Posted By Sami Hoda / Posted on 08/09/2006 at 9:49 PM


Sean Corfield As someone who has "switched" (from Mach II to Model-Glue - perhaps ironically because I wanted more control... over my application structure and flow), it's good to hear someone saying "It's OK". I've taken a lot of flak for being... was it Hal & Jeff who coined the phrase? ...a "framework butterfly"... but as an outspoken commentator on frameworks in general, I feel I need to work with a broad variety of frameworks and build real applications with all of them. And once you get to know the frameworks well enough, you can pick and choose the "right" one for each project you take on - as well as being able to take on a broader variety of projects.

There is no One True Framework. Each of the "big three" (I'm not familiar with ColdBox so I can't speak to that) really plays the same part in your application - the controller, the glue that holds your model and views together. As Hal pointed out in one of his podcasts, the framework is just about the least important part of your application.

Right tool for the right job? As an example, I built a site that was mostly a static site (content and navigation changes over time, programmatically) with a separate administrator to manage the content. I used Fusebox for the main site for performance (and because the logic was fairly simple) and I used Model-Glue for the content management part because it "fits" the way I think about data and relationships better (this was MG 1.x so no scaffolds, although I did use Arf! for the persistence layer).

Posted By Sean Corfield / Posted on 08/09/2006 at 11:11 PM


Sean Corfield Ah, found it... A comment on my blog criticizing me for switching frameworks...

"The only thing that concerns me is what effect does moving from framework to framework have on the developers under you and those influenced by you. Very few people are as sharp as you are to make the move so fast, and to understand its implications. What does this also say for stability?"

Guess who said that? Sami Hoda. Changed your mind Sami?

Posted By Sean Corfield / Posted on 08/09/2006 at 11:17 PM


Peter Boughton >> That framework was called...

Hey, someone pulled the end of the sentence off! Can you put it back please. :>



>> read a little about them and pick the one that strikes you.

What would perhaps be more helpful is if someone could do a simple explanation of what differentiates each framework. I've tried looking at them via the cfpetmarket example, but it hasn't really made things any clearer.
If there was a site that explained the differences - like Barney's post here: http://www.houseoffusion.com/groups/CF-Talk/thread.cfm/threadid:46622 - but with more explanation of what, for example, "stellar scaffolding support for autogenerating data entry/management applications" is, and why one might want it.

Posted By Peter Boughton / Posted on 08/10/2006 at 3:36 AM


Sami Hoda Sean,

I think you misunderstood what I said. Brian is speaking to the lay developer (its obvious from the choice of words), saying its OK, and how to think about frameworks in general. He says to stsrt small, and thats a key point.

I'd classify you as a leader/SME (not lay), and your changing so fast, as you did in the past may lead people to do so without thinking things through all the way. Your changes, and publicizing those changes, affect more than yourself. (There's a little army behind you, and most of them mimic.)

So it wasn't a "criticism". Its a compliment of your status in the community (quite the opposite!). Sorry you see it that way...

My comments always revolved around your importance, and impact to community. Thats always been my concern.

In our private discussions we've noted how you and I can make the move from framework to framework on big projects and probably not have to justify them as much as a normal developer would have to.

Picking the right framework for the project is one thing... you and I can do it. Sure. Nice. But what impact does it have to the business?

Let's say my company hires two Mach II developers, and I decide to start a project in FuseBox because I believe it to be better for the project. My managers would be pissed, because I've now moved to a framework which cant be supported as well as the Mach II stuff. Retraining required. Business impact. Etc. They'd quote my own words and say, "I thought framewords allowed for standardization!" It would be wiser in that situation to stick with Mach II EVEN IF its not the right framework technically.

So there are two sides. Stability also should be stressed. (Some of your examples of switching frameworks include your blog and the gccc app. But what of live web apps?) Business needs should also be stressed. And stills its OK to switch frameworks.. but get to that level of awareness first.. and if you lead, make sure to explain/caveat things properly.

Its 2AM, I probably dont make sense anyways and misspelled a bunch of things.

Sami

Posted By Sami Hoda / Posted on 08/10/2006 at 4:04 AM


Matt Williams It would be interesting to see more examples of why Sean/Sami/others would pick one framework over another based on the project. In my mind, any decent framework should work for any project. Picking one would be more based on the experience/desires of the developers at hand.

However, the scaffolding abilities of Model-Glue:Unity make it an obvious choice if you need a simple admin that lists options and allows you to edit those. I just had a project with exactly that and after a little learning/experimenting, I was loving MG:U. But as soon as you find yourself doing major customization, the scaffolding abilities are no longer a benefit and you may as well be using any framework.

For me, there are a couple of things that Model-Glue does that I wish Mach-II had. And vice versa. I still think that for both of these, the harder part is the Object Oriented side. Once the framework you are using is in place and understood, you spend very little time in any actual framework files and lots of time in your Model and View.

Good post Brian.

Posted By Matt Williams / Posted on 08/10/2006 at 7:02 AM


Peter J. Farrell Rarely do I comment often, but felt the real need to add my two bits...

One thing that I think Sami is trying to get at is that it is easily to follow the "so called important people" in the community. Nobody can be an expert on everything which means you have to rely on others for advice. The thing that I notice the most are developers that answer the "why did you pick..." question with "because X said so". This is a very dangerous thing for people to do depending on the situation of their company / needs. To blindly trust is equal with being ignorant in my opinion. This is getting more into politics as I write, but I fear the day when nobody no longer questions the the so-called "message" of the day.

I guess is basically what Matt and I talked about in our mini framework debate on the last podcast. I will take note with Brian's statement that an extensive review of frameworks is required. I think this would be an impossible task to undertake and moreover the data returned would more than likely be in error. There are too many situations / requirments to factor into the equation. However, I believe that all developers should familiar with the frameworks that they don't use on a regular basis.

You can call me whatever you would like, but IMHO I think that MG and Mach-II have begun journeying down different paths -- the full-stack versus focused-stack concepts. Now, I can't say what Joe will do in the future, but with the addition of scaffolding -- it will be a difficult task witholding more full-stack features. In my mind, the process has started. The good thing here is there is room for both "types" of frameworks in the ColdFusion world. It all depends how you like to structure and build applications.

The problems is how a person can obtain the necessary information to make an informed choice about frameworks. The knowledge required is just plain hard to understand. To take a phrase from Sean, OO is hard! The ongoing frameworks debate is less about the frameworks and more about learning OO concepts. In the end, you just have to start somewhere, choose something and make continue your "safari" from there. Making the correct decision up-front will just cause you to spin your wheels forever and this is where as I think the frameworks debate becoming a dis-service to the community. The correct answer is there is no correct answer! Bravo to you, Brian, for telling people to just jump into the pool. Maybe the waters will feel a bit chilly for a while. Remember that it feels warmer after you've been in the pool for a bit!

Posted By Peter J. Farrell / Posted on 08/10/2006 at 1:00 PM


Sean Corfield "The thing that I notice the most are developers that answer the "why did you pick..." question with "because X said so". This is a very dangerous thing for people to do..."

And this is why I've had to take example code down off my site and why, to some extent, I wish I'd never mentioned the potential performance improvements with duck typing!

I'm almost getting afraid to give any specific advice - it's why I've retreated to "it depends!" so much. I don't want people to just do what I say without thinking about it for themselves. Martin Fowler had a whole blog entry on this issue of "appealing to a higher power", i.e., justifying actions because "some expert said so".

Thanx for calling that out explicitly, Peter.

Also an interesting comment about the "full stack" vs "short stack" (sorry, thinking of pancakes)...

Posted By Sean Corfield / Posted on 08/10/2006 at 4:52 PM


Peter J. Farrell The "specific advice" comment makes me think about the downsides of blogging and the thought of having to append "it depends" on everything makes it an even bigger downer.

Actually, the funny thing is I usually say "short stack" -- although I am starting to like "focus stack" more these days. I can't remember who said full-stack to me, but it's in the Wikipedia definition of Ruby on Rails. I have yet to see any mention of the inverse that term -- hence focus stack. That is where Mach-II going with a focus on plugin'n'play versus the fully loaded. A la carte would be good! Ok, you made me hungery...

Posted By Peter J. Farrell / Posted on 08/10/2006 at 5:17 PM


Cary Gordon For a small development shop (like mine) this can be a critical issue. I have spent time with all three (no ColdBox, yet), and I am currrently working on a project with MG:U. I >think< I am going to stick with it, but I have one worry: What happens when I need to crew up for a bigger project? It isn't easy to find good CF programmers, but I think that there is a fairly good sized FB base. How hard will it be to find MG:U coders?

There is no way to know, really. I think that a commitment to MG:U implies a commitment to training coders, if need be.

Posted By Cary Gordon / Posted on 08/10/2006 at 6:11 PM


Brian Rinaldi Wow, some good discussion going on here.

First, I don't see any value personally in giving examples of how one framework may be better than another based upon the needs of a specific application. Honestly, if you have reached a point where you would feel comfortable swapping from one framework to another on each application then you seriously don't need my advice for one (and I am not saying that is wrong, but as I said in the post swapping out frameworks is easy in theory but it means you did things right the first time which takes practice).

Sean, I think the solution is to start telling people to do what Brian says....that way when things go wrong you can just blame me...and I promise to weild this power for good and not evil "Lex Luthor, ruler of Australia" :) Seriously though, I think it is a bit of a conundrum. On the one hand, for instance, I think it was important information you shared with the community regarding the performace improvements duck-typing can offer. On the other, suddenly there seemed to be a number of people pushing duck-typing as a solution for everything.

I think that is part of what I have been focusing on in this series is getting past that one right solution for everything mentality that can take over someone as they dive into objects and frameworks. I think people latch on to these solutions or even certain well-known community members in part because in reality there are no easy answers and "OO *is* hard". Therefore things seem much less scary when all I have to do is do as Sean says. Is that fair to Sean? No. Do I know what to do about it? No. Would I be a magnanimous ruler of Australia? We shall see!

Posted By Brian Rinaldi / Posted on 08/10/2006 at 8:19 PM


Peter J. Farrell The main I learned during my "leap" to OO is that no matter how much you research and how much you talk to people, you will do things WRONG! Brian bring up a good point, when he mentioned if you "feel comfortable swapping from one framework to another on each application then you seriously don't need my advice for one". The point is that you have practiced the "art." The only way to learn about OO and thus frameworks is to put your "art" to the test is by doing it. Book smarts only give you theoretical achievements. The foundation required to build your second application better than your first is plain old experience. So every just needs to get their hands dirty. Life is short...

Posted By Peter J. Farrell / Posted on 08/10/2006 at 9:31 PM


Write your comment



(it will not be displayed)





About

My name is Brian Rinaldi and I am the Web Community Manager for Flash Platform at Adobe. I am a regular blogger, speaker and author. I also founded RIA Unleashed conference in Boston. The views expressed on this site are my own & not those of my employer.