Framework One

This post is more than 2 years old.

Back in July Sean Corfield released a new framework: Framework One, or FW/1. Sean has a nice blog entry talking about why he created it. The basic gist is that Sean was looking to create something simpler and more direct than the frameworks in use in our community today. I've been a fan of Model-Glue for a long time. I've played with other frameworks, ColdBox most recently, but I've never been as satisfied or as happy as I am when I use Model-Glue. This holiday week I thought I'd check out FW/1, and while I don't think it will replace Model-Glue as my framework of choice, I was very impressed by it and had a lot of fun building a sample application with it.

Compared to Model-Glue, which uses XML to define it's behavior and settings, FW/1 is entirely conventions based. That's just a fancy way of saying that you do little to no configuration at all. You can rely on the framework's conventions to do a heck of a lot of work for you. At a practical level that means FW/1 is fast, damn fast. I had issues with these conventions at first - mainly just wrapping my head around them - but once I got into the groove it was amazing how quickly I could move. Each request will automatically run controller methods, service methods, and views that match. This means that a controller method that just chains off to a service method doesn't need to be written. Basically - any code that tied a getX call to a getX controller method to a getX service method will be unnecessary.

I've whipped up a quick demo. It makes use of ColdFusion 9 and ORM and must be tied to an existing BlogCFC database. It contains a grand total of 2 pages - a blog entry listing and an entry page. It also allows you to add comments. You can download it below, but please remember that I wrote this as an opportunity to play with FW/1 and it shouldn't be considered best practice.

So remember what I said about not having to write unnecessary code? The code to handle viewing a blog entry consists only of a service method, entry:

public function entry(string id) { writeLog(file='fw1',text='yes I ran'); return EntityLoadByPk("blogentry",; }

This method exists in a CFC called blog under my services folder. By convention, FW/1 will run blog.entry when I request blog.entry in the URL. I don't need to write a controller method at all. Nor do I need to define what the view is. FW/1 will automatically run views/blog/entry.cfm for me.

Anyway - download FW/1, check out their examples and mine, and see what you think. At the end of the day, the best framework is the one that works best for you, and while I still think Model-Glue is the best for me, FW/1 is impressive and I'd urge folks to check it out.

p.s. Note that FW/1 has ColdSpring integration, another framework I recommend folks check out.

p.s.s. So hey, what's the deal with this code in my controller:

<cffunction name="default" output="false"> <cfargument name="rc"> <cfparam name="rc.start" default="1"> <cfset variables.fw.service("blog.list", "data")> </cffunction>

I originally wanted to build the blog.default method in my service. I didn't like using "default" as a name since the real action was to list, but I was going to get over it. However - in a script based CFC, default is a reserved word. So, this gave me a good excuse to use a 'proper' name for the method in the service. I still wanted default as, well, my default action, so I used the controller method here to simply act as proxy. On reflection, I'd probably change the FW/1 setting for "defaultItem" to specify "list" instead.

Download attached file.

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 Mike Henke posted on 11/29/2009 at 8:01 AM is Convention Over Configuration also. I really like not having to mess with xml or setting handlers, events, etc. Plus CFWheels has built in ORM that just works in CF8, CF9, and Railo. No extra setup.

Comment 2 by Lola LB posted on 11/29/2009 at 5:24 PM

Do you have to put CFWheels at root level? Or can you install it as a sub-directory and map applications to it? I haven't played with it yet because of that root level requirement (I've got other stuff installed at root level).

Comment 3 by Chris Peters posted on 11/29/2009 at 6:07 PM

(Sorry to hijack your post about FW/1, Ray. :) It looks like a cool framework as well, and I need to check it out sometime in the near future.)

Wheels can be installed in the root or in a subfolder. The caveat to a subfolder deployment is that you must be using Apache as your web server if you want for the full URL rewriting to work (basically the ability to remove the index.cfm part of the URL).

Comment 4 by Mike Henke posted on 11/29/2009 at 6:53 PM

I have CFWheels in a subfolder on IIS and url rewriting.

I don't think you will need to map anything since CFWheels is self-contained. If you have another application, just unzip everything into that folder.

Comment 5 by Sean Corfield posted on 11/30/2009 at 5:20 AM

Thanx for the positive write-up of FW/1 Ray! Yes, setting variables.framework.defaultItem = "list" is a good way to make foo.list the default for foo section requests.

It's worth noting that Railo recognizes default as a function name in cfscript and lets you write this the natural way. I've logged a bug against ColdFusion for treating default as a keyword in this context - that's just silly!

Comment 6 by Matthew posted on 12/1/2009 at 5:24 AM


minor issue. The Framework One link in the post needs a little adjusting.

Comment 7 by Raymond Camden posted on 12/1/2009 at 5:26 AM

Fixed, thank you.

Comment 8 by John Allen posted on 12/1/2009 at 8:29 PM

FW/1 Rocks.

Comment 9 by Allen posted on 12/20/2009 at 1:29 AM

Thanks for the quick intro to FW/1. I look forward to seeing some more.