The first type of framework you will likely come across is one that encompasses the Model-View-Controller, or MVC, software pattern. A software pattern is essentially a solution to a common problem in software development. In this case, MVC is a solution to the problem of how to keep your View (the HTML) separate from your Model (your data) and being able to coordinate the two in an easy, flexible way (see Figure 1).

Figure 1. The MVC software pattern.
In MVC, the Model includes the code used to access the data that your application uses. Most commonly this is in the form of a database, although it could be external resources such as web services, e-mail servers, LDAP directories, and so forth.
The View is the code that builds what is displayed on the client, which for most web applications will be HTML, but could be Flash, or Flex for rich Internet applications.
The Controller ensures that the correct data from the Model ends up with the correct View so that the application logic performs as expected.
Imagine that you've just taken on a new contracting job. You’re working on a legacy system that has seen years of different contractors writing code in several different ways, and it's a complete mess. There are cfinclude tags that point to modules, which write variables to the client scope, then move them to the request scope before doing a cflocation. Trying to follow it through requires a Mensa membership. Multiple sections of the site are simply "no go", because you know that if you touch any part of them the whole system could come crashing down. It's impossible to test and impossible to maintain.
So you decide to re-write the site again from scratch. Since you don't want to get caught in the same trap, you choose to base your application on an MVC framework. Now you have a clear separation between your application flow, and your data and your view. It is far easier to develop, test, and maintain, and if another developer comes along, as long as they know the same framework, their code shouldn't be that drastically different from your own.
Fusebox, Mach-II, Model-Glue, and ColdBox are some of the more popular community MVC frameworks that are available for ColdFusion.
Among the oldest MVC frameworks available for ColdFusion is Fusebox, which recently had its 5.5 release.
Fusebox is based on the metaphor of an actual electrical fuse box in that it contains and controls a series of circuits, each with its own fuse. This corresponds to having a series of circuits to aid in breaking up your Fusebox application into related sections, each with a series of fuseactions that the framework is then able to run when requested by the application.
Fusebox only requires you to write ColdFusion templates; it prescribes neither a procedural nor an object-oriented approach when developing your applications. You can develop your application with just CFM pages, cfinclude tags, or custom tags. Alternatively, you can integrate ColdFusion Components (CFCs). Or you can use a combination of both, depending on your development style. This can be useful for those that have yet to adopt, or are migrating to, an object-oriented approach, and who are looking to ease the learning curve.
One of the advantages of Fusebox is that it gives you the option of using XML to configure your control layer (and thereby your application logic) or using conventions-based CFC to configure it. Using the XML configuration, you can extend Fusebox with lexicons, which enable you to write your own Fusebox actions that can be called directly through the XML. This means you can incorporate your own application logic very easily into the Fusebox paradigm, and reuse it across projects easily as well.
With Fusebox, you can also write plug-ins that allow you to execute code during Fusebox requests, such as when a fuseaction is executed or when an exception occurs.
For more information on using the Fusebox framework, visit http://www.fusebox.org.
After CFCs were introduced in ColdFusion MX, Mach-II was one of the first object-oriented frameworks introduced to the community.
The premise of Mach-II is that an application fires a series of events, and each event implicitly invokes different aspects of the controller code base.
This means that aspects of your application can be invoked, either through an event fired from a URL, such as http://www.foo.com/index.cfm?event=doThing, or through an event fired by the application code itself. Mach-II uses an XML configuration file to route those events to a series of listeners and filters and thereby determines what functions to invoke on them. This is why it is referred to as an implicit invocation framework.
The listeners and filters within Mach-II provide the main points in the framework in which to write your Controller logic code and enable your Model to provide the functionality for your application. Mach-II also gives you plug-in mechanisms, which allow you to intercept aspects of the framework globally, such as before and after a Mach-II event occurs.
The XML configuration file for Mach-II makes it easy to understand the logical flow of your application. It is laid out in a very sequential manner, which can be surprisingly helpful for those who are not used to framework development.
Recent developments in Mach-II, as it heads towards a 1.6 release, have included built-in caching and logging functionality as well as other extensions to provide developers with more pre-built tools to build their applications.
To learn more about Mach-II, visit http://www.mach-ii.com.
Model-Glue is another object-oriented framework for ColdFusion that operates on an event-based, implicit invocation paradigm with an XML configuration file. It works with a Publish-Subscribe software pattern, however, which is slightly different from how the previous frameworks were developed.
Much like the idea behind a magazine subscription, message listeners can be registered to receive event messages that are then broadcast to them. This allows you to set up multiple listeners to receive the messages that are broadcast, giving you a flexible way to develop and extend your application through a highly decoupled system architecture.
Since version 2, Model-Glue has also had direct integration with ColdSpring, a dependency injection framework, and Transfer and Reactor, two popular object-relational mappers for ColdFusion (discussed later in this article). This means that Model-Glue can provide functionality such as scaffolding, to generate and display a basic user interface for listing and editing database data, which can be very useful for application prototyping and development.
Model-Glue 3, currently in alpha, also provides some really interesting new features, including development-time code generation, and tighter integration with ColdSpring for CFC dependency injection into listeners.
For more information on Model-Glue, visit http://www.model-glue.com.
ColdBox is one of the more recent MVC frameworks offered to the ColdFusion community. It has picked up a lot of momentum and development over the last twelve months. Like Mach-II and Model-Glue, it is also an object-oriented, event-based, implicit invocation framework. What sets ColdBox apart from the crowd is its relative lack of XML configuration.
ColdBox uses conventions to match handler CFCs within a specified directory, and methods within those handlers to ColdBox events that can be fired either from the URL or from within the application logic. As such, there is only a single XML file for configuration settings; however the logic of your application is purely managed by CFML.
ColdBox also lets you intercept framework specific events, such as application start-up, session end, or event processing, using interceptors, which you can also extend to allow for your own application-specific interception points.
A wide variety of application building tools, called plug-ins, also come bundled with ColdBox. These include caching support, error handling, logging, and integration with dependency injection frameworks ColdSpring and LightWire, which can greatly increase your productivity as they make many of the common tools you need to develop applications available to you.
For more information on ColdBox, visit http://www.coldboxframework.com.