By Peter Bell

The Future of Controllers: Setting the Scene

With the popularity of Mach-II and then Model-Glue, there has been an almost unquestioned rise of the OO, implicitly invoked front controller as the main way to implement controllers in ColdFusion. While that is still an appropriate approach for many use cases, in this short series of postings I want to argue that changes in both requirements and best practices should cause us to review the types of controllers we use.

While the vast majority of ColdFusion applications are consumed by traditional HTML clients, more and more projects need the ability for the model to be shared between some combination of HTML, AJAX, Flex and web service requests. For me, the ideal controller would be designed to support all of these approaches out of the box.

While Mach-II and Model-Glue can definitely be used to provide such solutions (and are being used in this way on a regular basis), I think that it is worth stepping back and looking at the “ideal multi-modal controller” to confirm that the approaches that have helped MG and M2 to be successful are still the best way to go.

At the same time, new approaches like continuation servers and spring web flow are showing up the weaknesses of a stateless event based controller for managing complex wizards (sophisticated checkouts, multi-page wizards with branching logic and the like). A state-machine metaphor is actually much more convenient for solving this class of problems.

Given these changes, I think the time is right for a public re-evaluation of best practices in controllers. I am not saying that the review will do anything other than make it clear just how well suited M2 and MG are for developing robust applications quickly and cost effectively, but I think it is worth a little time to go back to first principles and see if any alternate patterns emerge as worthy of consideration for any classes of use cases.

I have some paying work to do tonight, so this will be a pretty brief series, but please jump in with your use cases and experiences. Lets see if there is anything we can all learn from this review – even if it is just how smart we all already are by using the two M’s! :->

Comments
Wow, from the title I thought for sure this was an entry on the Wii and its controllers. lol
# Posted By Joshua Cyr | 11/27/06 10:51 PM
Funny! Guess I should get out more :-<
# Posted By Peter Bell | 11/27/06 11:02 PM
Yeah I got to agree with Josh on that one. lol I can see why he was thinking Wii when reading the title. I unfortunately knew what to expect. ;)
# Posted By Javier Julio | 11/28/06 9:37 AM
Yeah, sorry guys. You're going to have to stick with Gizmodo and Engadget for that stuff.
# Posted By Peter Bell | 11/28/06 10:15 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.005.