ColdFusion continues to thrive, even more so under the auspices of its new owner, Adobe. With the release of the latest version of ColdFusion, Adobe has reaffirmed its commitment to ColdFusion by releasing the most feature-rich version in years.
Whether you've never used ColdFusion before, you're considering coming back to the fold, or you're looking for a good reason to upgrade, ColdFusion 8 definitely deserves your consideration. Indeed, ColdFusion represents a major release, with more new features than I could possibly cover in a single article. In short, now is a very good time to be a ColdFusion developer, and in this article, we'll look at my favorite reasons why.
Speed Improvements
What's that you say? Speed is not a feature? Well, when the improvement is as dramatic as it is in the latest version of ColdFusion, it can definitely be considered a feature. The ColdFusion team analyzed over 100 actual customer applications to find and eliminate bottlenecks. This resulted in an overall improvement that makes the server up to 4.25 times faster than the previous version of ColdFusion. In fact, some specific areas and tags are 39 times faster than prior versions. In particular, if you're undertaking object-oriented development using ColdFusion components (CFC), you'll notice a marked improvement.
The best part is that you don't need to do anything to take advantage of this feature other than installing ColdFusion. Without changing a single line of code, your existing ColdFusion application will see a huge performance boost. So, here's the plan...
?If you aren't already developing with ColdFusion, it's important to keep in mind that ColdFusion has long since outgrown the accusations of being slow or unscalable. As a developer at The Economist who recently upgraded to the latest version of ColdFusion noted, "...the whole thing is ridiculously stable."
Server Monitor
Sometimes, when diagnosing application performance issues in previous versions of ColdFusion, it felt like you were a doctor trying to diagnose an internal injury without access to an x-ray machine. You knew something was generally wrong inside, but you had no way of seeing (and therefore, of treating) the issue. Well, the good news is that ColdFusion (Enterprise and Developer versions) comes with an x-ray machine ... er ... a server monitor that allows you to peer at the internals of your ColdFusion server on which you're running your application.
The ColdFusion Server Monitor is a Flex application that allows you to examine a variety of statistics related to the overall health of your server. It provides you with details about specific applications, sessions, requests, and queries. For example, you can get reports on slow requests, and drill-down into those requests to see variable memory usage for each request, as well as the performance of any includes custom tags and components within the request. This can help immensely when you're trying to locate bottlenecks within a slow request. In my opinion, this feature alone will have a huge impact on how developers will build and debug ColdFusion applications going forward.
In addition, the Server Monitor offers customizable alerts that allow you to receive a notification when certain undesirable behaviors occur, such as low JVM memory or excessively long-running threads. You can even customize the response that the Server Monitor implements when this behavior occurs, configuring it either to send an email, create a snapshot, kill threads running longer than a specific timeframe, or even execute a set of custom code from within a ColdFusion component that you specify.
Ajax Integration
In previous versions, ColdFusion added Flex integration, which made it the language of choice for building Rich Internet Applications (RIAs) using Adobe's Flex. This was great for those of us who love Flex (as I do!). However, building RIAs with Ajax required the integration of third-party open-source libraries if you wanted to work natively with ColdFusion data types and JavaScript. It also meant that you had to include and learn the syntax of one or more external JavaScript libraries like Ext, Spry or the Yahoo User Interface library (YUI). With ColdFusion 8, this is no longer the case.
ColdFusion has added a long list of new tags and features that have been designed specifically to allow you to rapidly build Ajax-based Rich Internet Applications using a comfortable and familiar tag and function syntax. In fact, the libraries that I mentioned above are built into ColdFusion 8, making it possible, for example, to create an Ajax grid using Ext simply by using the cfgrid tag. You can even bind this grid to a dataset that's returned by a CFC method simply by putting a reference to the cffunction into the bind attribute of the tag. ColdFusion 8 really does make it incredibly simple and intuitive to add some glitz to your application by integrating rich user interface elements.
Even better, in my opinion, is that the Ajax integration in ColdFusion 8 goes much deeper than simply adding fancy UI elements to your application. ColdFusion added tags and functions that allow you to easily move data back and forth between JavaScript. For example, with the cfajaxproxy tag you can make functions that reside within a CFC callable directly from your page, using JavaScript. This feature will even automatically convert data types (such as a ColdFusion query object) into a type that's usable within your JavaScript block, such as an array or as JSON packets. The created proxy also contains built-in methods for setting a callback handler for the asynchronous method calls. All of this makes working with Ajax and ColdFusion feel completely seamless.
The following example code shows how the cfajaxproxy tag can be used to create a class-based upon a component that can be used within JavaScript:
Debugger
A long time ago, ColdFusion had its own IDE called ColdFusion Studio, which included a step debugger. When that tool moved on from this world, ColdFusion programmers became experts at trying to debug through the cfdump/cfabort method, which basically entailed dumping the value of a variable on-screen and aborting the request. While this was effective, it has some major drawbacks, the primary one being that it was an extremely slow and tedious process to debug an entire page this way. Nonetheless, many ColdFusion programmers like me grew accustomed to the drudgery and forgot what we were missing ... Well, we're without a serious debugger no longer!
The ColdFusion 8 debugger was built in the Eclipse IDE, which is a tool that will be familiar to anyone using either Flex Builder or CFEclipse. The debugger allows you to set breakpoints and to debug requests running on either a local or remote ColdFusion instance. Once a breakpoint is encountered, you can inspect the value of any and all variables within any scope contained in the request. Additionally, you can step through the request and watch certain expressions to look for inconsistencies in the value settings. I believe this, combined with the Server Monitor, not only makes the debugging process much easier but allows us the insight to create much more efficient and bug-free applications. Not that I ever write bugs! (Ahem! -- Editor.)
Multi-threading
I liken the addition of multi-thread capabilities to ColdFusion 8 to being bitten by a radioactive spider. It provides the developer with a great deal of power, but we all know what comes with great power ... yes, usually fame and money, but in this case I'm referring to great responsibility. Additional threads are used to improve the performance of a request that contains some sort of long-running process which is passed off to a thread. Typically, threads can either be:
ColdFusion makes it very easy to spawn new threads with the cfthread tag. Any code contained within the cfthread tag is executed asynchronously, with the current request existing in an independent stream of code execution. The remainder of your request can continue to process without the need to wait for the thread's code to finish unless it's instructed to do so. Any experienced programmer will have run into a multitude of situations where the page request shouldn't need to wait for a particular process to run before continuing, so clearly this is a very useful function (despite its propensity to be misused).
To give you an example of how this would work, the following example shows some code that loops through an array of RSS feed URLs and uses the new cffeed tag to parse the RSS XML. It processes each feed on a separate thread so that they can all run simultaneously, reducing the overall time it takes to process the page. Once the threads are complete, another cfthread tag is used to rejoin them to the current thread, where we can output the values. Those of you who are already familiar with ColdFusion might also notice that I'm using the new implicit array creation to build my feed array:
#cfthread[thread].myProps.title#
Even More...
As I said earlier, there are so many new features in ColdFusion 8 that I can't possibly cover them all in detail here. However, here's a handful of the key features that might pique your interest in this new release:
Summary
As you can see, so many new features are included in ColdFusion 8 that your five favorites might be entirely different from mine. If you haven't tried ColdFusion 8 yet, what's stopping you? The Developer Version is free, after all. Give it a go!