In my last post, I gave my insight into the FuseBoxCFC framework that was presented at the frameworks conference.

One of the points that I made was that I and other people didn’t like the fact that it was using the cfinclude tag from within the CFC because of var scoping issues. This got me thinking how other frameworks call the views in an application.

So I download a popular framework to see how it handle this and guess what, it uses cfinclude just like FuseBoxCFC does. Actually what it does is wrap and cfsavecontent around a cfmodule and have the calling template issue the cfinclude. It’s a little wacky but I guess this gets around the var scoping issue.

I guess this means I can’t say anything about FuseBoxCFC using this approach when other frameworks are doing it as well.

FuseboxCFC: my take.

February 2, 2007

Even though I didn’t attend the Frameworks conference this year (I wanted to really bad), I have watched the presentation of FuseboxCFC that Webapper has online once Ray posted the link to it in his blog. This has been something that I have been anticipating since this whole debate about using XML config files in frameworks started.

After watching all 4 videos, I thought that I would give you my take on it.

I can see why he is choosing to use CFC method calls directly with the cfinvoke tag rather then XML. If you really think about it writing event nodes with an XML document is just mimicking calling a CFC method. You write an event node for user.list and have some sort of CFC behind it to get a list of users for you and pass it back to the framework. This approach just cuts out the XML middleman and call the CFC method directly. In excess this will give you a performance boost to the application since you’re eliminating a layer. Also this method is being used in some other already existing frameworks.

Why I understand the speed benefits of this approach, I could see right away that it is very hard to follow the flow of your application without opening up multiple files and mentally piecing your application together in your head. Even though using XML does slow your application down a little, it is nice to just be able to open up a single file and seeing how the application flows and pieces together.

The other thing I noticed was the use of cfinclude tags with the CFCs to grab the views. I saw from Ray’s post that this didn’t sit well with some people because of the whole var scoping your variables thing. I will agree that this doesn’t sit well with me either, however there are ways of generating content from within CFCs that are scope safe.

Probably the most common method is using the CFSAVECONTENT tag to wrap it around the content you want returned from the CFC method as you can assign an already properly scoped variable to the result. This approach does have it draw backs as the CFC can gets pretty long and I remember a blog post (that I can’t find at the moment, could someone point it out to me) where someone said that a component could only have 4096 lines in it.

Steve has pointed out that the var scoping issue is a bug and should be fixed, I agree whole hearted, but until then maybe some other approach could be used that would make everyone happy.

His experiment does follow the whole MVC directory layout. I have seen other frameworks that don’t and although this is a trivial matter, it would turn me away from even looking at it if it didn’t.

There was some FuseBox 1.0 nostalgia with the whole putting each query into a file. Though I can see why we did this in the old CF4.0 days, I would probably use Reactor for handling all the database stuff.

All and all, a good first draft, I’m impressed. Does it have some work, sure, but that’s expected, nothing is right the first time around.

If you haven’t watch the videos, I would suggest you do. Draw your own opinions. The presentations online are really good at explaining everything.

So I finally did it (no, not that you perverts), I’m making the switch to Model-Glue and loving it. I thought that it would be a lot harder then it really is. I’m already becoming comfortable with the XML and putting my mind into the whole MVC mode. I also decided that, what the hell, I should take Reactor by the reigns as well (Note to Reactor guys. Please setup some sort of homepage for the project.).

So in my little quest for MG goodness, something hit me last night: Where are all the action packs?

When I downloaded MG it came with one, the email action pack, and although I haven’t played with it yet, I love the idea behind action packs. I read a post from Sean Corfield from a while back on how he his team is using them, very sweet. Thing is, I can see MG getting bigger and more of a user base. There should be some sort of repository for all of the user contributed action packs that people will be writing,  much like CFLib.org. It would also help a newbie like myself to examine how other people write and structure their MG applications.

If anyone knows of one, point it out to me since I can’t seem to find one. If there isn’t one out there, then I just gave Ray another web site idea that he can run with. Maybe he could add an action pack section to CFLib… hmmmmmm.

Currently I’ve been doing an on going project now for quite sometime. The problem with this like another project is that it keeps growing and it getting wacky trying to manage the different modules and updates. I’ve been thinking that it would probably take about 3 days to convert this puppy over to Model-Glue so that it will become more managable for me

So here’s my question, Is Unity usable at this point or should I just download 1.1 and use that? I would like to use Unity because of the scaffolding features and because I’m sure there are some bugs in 1.1 that Unity fixes. Is there anyone using Unity with success at this point for any projects in production? If so, what build are you using and are there any gotchas that I need to be aware of.

I’m counting down the days until Joe finally releases Unity.

NOTE: I don’t mean to shun out the other frameworks out there, but over the last 3 weeks I’ve been downloading and looking heavily at the different frameworks available for CF. After looking at 6 different ones, Model-Glue felt be the easiest to grasp and follow. This is by not means a hit at the other frameworks that I looked at, I just think that when the next person takes over this project it will be easier to jump into if it was written in Model-Glue.

Andy Jarrett hit upon something extremely interesting in a recent blog post: When not to use a framework. All the hype surrounding frameworks in the CF community lately has recently started to turn into a war. Which one is better, faster, more stable and practical. Depending on which one you use, your opinion will be different from the next guy.

Frameworks do make our lives easier by giving us a universal way of structuring our applications. It’s great when you later have to come back to a project written in say MG and need to do some tweaking or adding, that you know where to put things and can follow the logic. It’s also great if you get handed someone else’s project and can follow their logic. This is all done because the framework is the system that sets the logical flow of the application and not the individual.

But even though frameworks tend to make programming applications easier, they also bloat application just as well. I remember when Fusebox came out long ago and it was all the buzz. I remember one of the example application processing templates at 400ms. I took that example app and rewrote using straight procedural code and got the thing to process the templates in 10ms. The same can be said for the frameworks today. With all the overhead of the framework handling the event calls of you application, you application will be slower than if you just wrote it using straight CFC calls.

So when would be an appropriate time to tell someone to just dump frameworks altogether? To me it comes down when a portion of an application needs to run as fast as possible and can separated from other portions of the application. I’ll use BannerBoxes as an example.

The main portion of the site, where advertiser and publisher manage their account and sign up, uses a particular framework to make development quicker and easier for me. This portion of the site doesn’t get millions of hit a day, so I can trade off manageability for speed. I’d rather be able to quickly add another section to this portion of the site or have someone else be able to add it for me and the framework does makes this possible.

Now the Feed and Click processing portions of the site do get millions of hits a day. These portions of the site need as much speed as they can get. These portions do not use any frameworks as I can’t afford to have any overhead whatsoever. When you’re processing millions of feed pulls and clicks a day, 10ms in template processing DOES make a difference and it IS noticeable. These portions use straight CFCs with A LOT of caching to perform this feat.

So in closing, I’m NOT trying to bash all the frameworks out there or telling people not to use them in their development life cycle. What I am saying is that sometimes people need to stop and think if using a framework is the right move in a particular portion of an application that requires that portion perform at top speed.