Framework One for when you don't need a framework

I've just deleted about 2 hours worth of writes and re-writes to simplify what this blog post is all about. Originally I was going to waffle about frameworks and how they can be bad for a project and how they can get in the way but they're not all-round "bad" for every project yada yada. In reallity this blog post is about 1 thing, Framework One, and how its so flexible I'm even using it for basic brouchware sites.

Sure for your big MVC/OO apps you can use FW/1 with your dumb Controllers passing data to the Service layer to request other data from the model to pass back to the view. Which is great, but what I've also enjoyed is that on the otherside it doesn't stop you from very quickly creating a 3 page brouchware site for your family member that doesn't require more core files for features you don't need i.e. dependency injection, than there are application files. Its actually because of all the corse files that in the past I would not of advocated a framework by any means for a 3 page site and it is all down to the overhead of the required CFC's. That stance has now changed and I am going to show you why you should even use Framework One for when you don't need a framework.

As with most code related samples it best to build something; so what the site spec? We are going to build a three page brochureware site (with little or no style) for our family member, Marvin Acme. Marvin wants a simple site that he will hardly be updating but is out there so he has an internet presence. He doesn't care about how we build it or anything techy like MVC and just wants the three following pages:

  1. Home page: Something short and sweet about ACME gadgets to capture and kill rodents to grab the user.
  2. About the company page: Giving background history on the company for it Wile E. Coyote kind of customers to read.
  3. A contact us page: with an address, telelphone number, and maybe even an inline Google map.

Probably not the best spec in the world (at the same time probably better than a lot of other specs we've all seen) but lets get going.

All of this is seems easy so lets clear something up now, without frameworks I'd go off and create a /tags/ folder which holds layout.cfm and for each of the 3 pages I'd use cfmodule wrapped around the contents. I might even have a Application.(cfm|cfc) for holding some site details. There is nothing wrong with that by any means and is just fine for a site this size. What I want to demonstrate to you is that you can do this just as easily with Framework one whilst:

  1. not thinking about or worrying about MVC/OO,
  2. by editing no more files than you would of if you had done thiswith spaghetti code without a framework,
  3. and while keeping the support of structed code just incase youever need to add a feature later.

Begin by downloading FW/1 from

  1. Create a new folder on your webroot called /acme/ and in there from the Framework One download copy/org/corfield/framework.cfc (directorys as well)
  2. In the FW/1 examples copy the contents of hello1 in to the /acme/ folder
  3. Your /acme/ folder should look something like the following
    Folder setup

You should now be able to go to localhost/acme and see the following:
Test acme setup

This first post is all about the setup and how we have the bare bones already created and we haven't touched a line of code yet. In the second post we are going to create our simple app for Marvin Acme and we'll build it without editing anymore than 4 files (no different than the cfmodule route) or even think about a bloated XML configuration file.

Found out more about Framework One via: