The Dopefly Tech Blog

« The Dopefly Tech Blog Main page

Front Controller Frameworks Suck

posted under category: ColdFusion on March 2, 2010 by Nathan

I always hated them for this one reason. How do you explain this URL:

What I dislike about that is...

  • It's hard for your users to remember or even type
  • It's ugly to see
  • Your web stats say everyone visited one page - index.cfm - they had different query strings, but they only visited one page
  • Your SEO is hurt. How does the googlebot know the difference in importance between the fuseaction query param over any other params? Sure, it's smart, it knows, but it can't really know, you know?
  • It reduces the number of results in this search

Really, it comes down to your users, their experience, and how they see your application. While it's not as important as your usability, design, content or uptime, it does take away from the overall quality.

So what can be done about this problem? Few have tried, some have succeeded. Here are the strategies that are out there.

  • CFM pages everywhere.
    This is generally the opposite of using a framework. All of the hassle, none of the benefit.
  • URL Rewriting. As requests come to the server with an attractive URI, they are translated into whatever your application needs to load it by.
    This is a good strategy, and it works well. On Windows with IIS, most of the software is either expensive or buggy, and definitely not portable. On Apache, mod_rewrite is great. Either way, you cannot make a cross-platform solution, meaning URL rewriting on an open source project is a no-go.
  • Generated CFM pages everywhere.
    You have software that spits out static files from dynamic actions in your framework, that call back in to your framework. In our example, a /main/default.cfm page would be generated that may set the fuseaction querystring parameter and invokes the framework. This is a great solution, but I've never heard of anyone putting it to practice. Writing this software is deceptively complex.
  • The OnMissingTemplate rerouting method.
    You link to pages that do not exist, then have an onMissingTemplate handler in your Application.cfc file that redirects requests to your framework with the right parameters. This new URL might look like, which doesn't exist, so your onMissingTemplate method fakes like it's the ugly URL and invokes the framework.

Can anyone think of another method of doing it?

Personally, I like the OnMissingTemplate method a lot. The distinct advantage above the URL rewriting method is that this one is portable without installing other software. Of course it doesn't work everywhere, but it almost always will.

In summary, make your users happier and write your next application with a better SES strategy.

Nathan is a software developer at The Boeing Company in Charleston, SC. He is essentially a big programming nerd. Really, you could say that makes him a nerd among nerds. Aside from making software for the web, he plays with tech toys and likes to think about programming's big picture while speaking at conferences and generally impressing people with massive nerdiness and straight-faced sarcastic humor. Nathan got his programming start writing batch files in DOS. It should go without saying, but these thought and opinions have nothing to do with Boeing in any way.
This blog is also available as an RSS 2.0 feed. Click your heels together and click here to contact Nathan.