ColdFusion 8 Ajax Controls: A Little Thought Can Save Your Butt

ColdFusion 8 is looking very hot and its gotten a tremendous amount of much deserved attention. Having done Ajax development with other tools, I'm obviously very interested in the Ajax widget tags included in CF8.

Dan Vega had a nice, straightforward example of using CFWINDOW to build a very sweet looking dynamic window. When I did a "view source", I was kind of shocked by the amount of javascript libs being included. You had files from Yahoo User Interface (YUI), Ext, and some others which seemed specific to Adobe (Spry maybe?). There were a total of 12 javascript files loaded automatically by CF 8 in order to popup the dynamic window. So I whipped out FireBug and did a quick analysis and noticed that the libraries totaled ~330KB! Holy cow! There's a lotta library in that page. Now you might say, "whats the big deal? Customers have broadband!". Um, sorta. While broadband continues to grow steadily, its still important to consider those visitors on the low end of the spectrum (eg: dial-up).

This got me thinking about some of the things that I've had to contend with as I got involved with client-side development; especially Ajax.

Using these new tags is definitely enticing and its going to give CF developers a great way to get introduced to client-side dynamic effects including Ajax, without the headaches of hand-coding so much stuff. Shoot, Ben Forta has posted 3 CF8/Ajax tutorials that have stunned me due to the power and simplicity of the implementation.

But for those just jumping into this whole DOM/JS/Ajax thing, it is REALLY important to evaluate your visitor expectations not only from a business perspective but a technology perspective. Don't make the assumption that every visitor you have has broadband or, even tougher to deal with, JavaScript-enabled. If you're targetting customers who traditionally are not the most "wired", you may be in for a big surprise when they encounter a site thats not as responsive as you thought. This could equal lost customers and/or lost sales.

So my point is to tell you to definitely embrace the new Ajax widgets in CF8 (and those of any library) with a little forethought. By doing so, you need to start rethinking your approach to how your target audience will be affected. Everything from bandwidth to accessibility to security will now need to be thought through to make sure your apps work for your visitors.

To get you started with CF8's Ajax capabilities, here are a couple of tutorials from Guru Ben Forta:

ColdFusion Ajax Tutorial 1: Auto-Suggest ColdFusion Ajax Tutorial 2: Related Selects ColdFusion Ajax Tutorial 3: Live Data Grids

I would also HIGHLY recommend this posting to get to understand progressive enhancement.

Progressive enhancement with Ajax

If you don't know what progressive enhancement is and you're planning on implementing DHTML and Ajax, you're doing yourself and especially your site visitors a disservice.

Welcome to Ajax fellow CF'ers!

Related Blog Entries

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Jim Priest's Gravatar Great post! This weekend I was just over at a friends house who has dial-up. It was painful!

I'm hoping by the time we upgrade to CF8 someone will have figured out how to integrate jQuery into the mix and reduce some of that overhead :)
# Posted By Jim Priest | 6/3/07 10:27 AM
Joshua Cyr's Gravatar While using YUI a few months back I found that the regular library of files were very large. Good for testing etc. Then you change to the -min set of code and the size dropped significantly. So perhaps we can expect a change by the time it ships? Easy enough to replace the files with the smaller files manually if needed. For example autocomplete.js is 20k, autocomplete-min.js is 8k.
# Posted By Joshua Cyr | 6/3/07 10:45 AM
Rey Bango's Gravatar @Jim: Thx man. I just want to make sure that folks who haven't done a lot of DOM/JS/Ajax work consider this when developing their apps. This applies to any library but since I believe that many developers will embrace these cool new tags, its important that they think about these things.

@Joshua: That would be very cool if they could do that. I do know that these are custom versions of the specific libs so I'm not sure if they'll react to their mainstream versions but if Adobe could do something to trim them down or tell us how to, that would be a huge help.
# Posted By Rey Bango | 6/3/07 6:05 PM
Charlie Arehart's Gravatar Folks, I just want to point out that there was a follow-up message Rey wrote which addresses this further. I realize it's listed in the "Related blog entries", but I missed it until I raised this with concerned folks who pointed me to it. The updated entry is:

http://www.reybango.com/index.cfm/2007/6/6/CF8-Aja...
# Posted By Charlie Arehart | 6/16/07 10:43 PM
Rey Bango's Gravatar @Charlie: Thanks for linking that Charlie. I just received a new version of the feed reader code from Ashwin of Adobe which is supposed to reduce the size even further than I previously wrote. I'm so happy they're taking this seriously and going through a lot of effort to improve the page sizes. Great work Adobe!
# Posted By Rey Bango | 6/16/07 11:45 PM
Charlie Arehart's Gravatar Well, it is still just a release candidate. I'd like to think this would have been just part of many other continued optimizations they'd undertake before final release. :-) Thanks for pressing the issue, though. You never know when something could otherwise slip under the radar.
# Posted By Charlie Arehart | 6/17/07 12:41 AM
J.'s Gravatar That is why JQuery rules. 19 K gives you the ability to do a lot. All in one file.
# Posted By J. | 8/2/07 6:47 PM
Rey Bango's Gravatar Yep, jQuery is awesome. :)
# Posted By Rey Bango | 8/2/07 8:53 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.