I Am Speaking at cf.Objective() 2010

I'll be speaking on building applications with ColdFusion and ExtJs at cf.Objective 2010. I was very honored to be asked to submit a topic alongside so many fantastic speakers and developers. I'll post more as the details are refined.

Out With The Old, In With The New: 2009 - 2010

Wow! Where has all the time gone? This morning I'm looking back on 2009, and it has flown by. We've watched our banks collapse, and our government bail them out. We've watched the housing market go to pot, and friends and family have lost their homes. We've seen congress attempt to pump life into a social health care program, and watched it divide a nation. We've seen the auto industry grind to a halt, and seen iconic brands completely shut their doors. It's been a depressing year.

I think many of us have had a hard time keeping a positive attitude this past year. I know that the early part of the second half of this year I saw my own morale hit lows, the uncertainty making me moody and impatient. I was waiting for something (anything) positive to happen. You can see it on this blog as well, when you see that the last post made was in October, and I never even touted the release of ColdFusion 9 (which is well worth blogging about). But, things have changed.

A few months back, I had a personal epiphany. I reminded myself that change is only affected through action. My inaction was pulling me down, not really adversely affecting my work or family (yet), but not doing anything to improve my conditions either. So, I woke up. I decided that I would be my own positive force for change. I apologized to those I worked with, and vowed to find my inner motivation, to move forward with purpose, and challenged them all to do the same.

In that time, my shift in thought, word, and action has brought about personal change and growth. I have consciously worked to change my own personal perspective of each situation, to take on each new challenge as an opportunity, and to give more of myself to others with a servant's heart. I have, once again, realized that happiness begins with a decision; knowing that the only person's thoughts and actions that I can control are my own. I can influence others, through my words and actions, but I can not control them. If I maintain a path of right thinking and right feeling and right doing, then that influence can be a positive influence, and I will be happier for doing what is right.

So, where have I been? Well, I took the time to read some fiction. I generally read one fiction title a year, but this time I read fourteen (in a row). I also took in some self-help and leadership titles that I've been putting on hold for a while. I did some work on my open source CFQueryReader project, put in a topic for cf.Objective() 2010, and committed to updating Learning Ext JS for a 2nd Edition around the changes in the ExtJs 3.x releases (with more ColdFusion examples).

At work, we've undertaken a key rewrite of our most important front-end application, which has been exciting, challenging, and rewarding. We have several high priority projects that we are completing prior to a major conference in February. Currently, we're hiring for several positions, with a very active interview process. And, most recently, my boss decided to pursue other interests, and I have taken on the interim Development Manager position. This alone has been a major transition, with many extreme shifts in my basic duties and responsibilities, but has been very exciting and rewarding as well. It helps to have such an outstanding team, within Development, as well as so many great people who work with us day to day.

Last night, my wife and daughter having fallen asleep already, I was standing on our back deck at the stroke of Midnight. All around the neighborhood I could hear cheers and singing, while fireworks were going off left and right. I stood there, staring up in the darkness, and said a prayer The Father. I prayed for the strength and wisdom to approach the coming challenges of this new year. I prayed for the vision to see each new opportunity, and the will and courage to act when necessary (and the understanding on when not too). I prayed for patience and guidance, in discovering what new paths I am meant to walk upon. I prayed for the health and well being of my family and friends, that they might continually have love, life, and prosperity. And I prayed that everyone would endeavor to improve their own understanding, of themselves and their fellow man, so that we might all create a better world in 2010. If everyone endeavors to become better, and do what they can to make life better for those around them, then we can make this world a better place.

Happy New Year everyone! May 2010 be your year of greatness!

Can We Extend the ColdFusion Server

I love playing around with new toys. So, I'm ecstatic now that ColdFusion 9 has been officially released to the world, and even more so after what I'm about to tell you. Oh sure, I've been playing around with the betas, but mostly in testing the cfajax/ExtJs 3 upgrades (and I'll be posting more on that in the coming months). Time has been somewhat limited for me, so playtime has had to take a back burner. But, I wish I had gotten into this a bit sooner.

Yesterday I finally got around to working with some of the new cfscript implementations. I find these upgrades to be one of the key features for me personally. One, It's a faster coding style for me. Two, I was getting tired of bouncing between script and tags. Three, I really like the economy of code associated with script, finding it to be far less verbose. So, I'm lovin' the fact that I can write all of my CFC's, including my Application.cfc, in pure script. Now I can keep the tags with the display. But, as someone pointed out to me in a recent comment, there are still a few tags (anyone know which ones?) that haven't yet gotten script implementations. What can we do about that?

So, in diving right into playing with script enhancements, I ran into a few roadblocks. Minor errors, stemming from me not properly understanding the implementation. Now, the first place I went was to the documentation. Ray Camden keeps saying to me "Why don't people read the documentation?" I'm one of those that agrees with him. Yes, the documentation has some holes, and even bad examples, but you would be surpised what you can learn. (Read on, you'll see where I'm going with this!)

[More]

Scripting a ColdFusion Application

With the release of ColdFusion 9 this past week, at MAX, we finally have full parity for cfscript with all of the cf tags. I personally prefer script when writing data access and business logic. For some it might not appear to be the sexiest feature, but I can see it making CFML much more appealing to developers from other languages.

[More]

ColdFusion Ajax and ExtJs Presentation Update

I've been asked to present to the KCDevCore on ColdFusion 9 Ajax and ExtJs. This will be an updated version of my ColdFusion Ajax presentation, with new content to cover the updates and new components presented in ColdFusion 9 and ExtJs 3.0. By request, I'm going to try to keep the slides to a minimum and get down to some code.

That presentation will be next Tuesday, September 29th, at 7 PM CDT, and will be available via the KCDevCore Adobe Connect.

For those who don't know (where have you been?), ColdFusion 9 is now in public beta on Adobe Labs.

Mango Blog Releases 1.4

Mango Blog 1.4 has been released. Some nice fixes and improvements here, from searh to user permissions to Railo support and improvements for Plugin use and development (something I hope to dive into real soon).

For those who've never looked at it, Mango Blog is well worth the download. Especially as a code study. Very well structured application. To Laura, Seb, and anyone else contributing to Mango: Congrats on the new release. I look forward to working with it.

ColdFusion for the Redmond Crowd

Some time back I started receiving Visual Studio Magazine. I'm not sure why. I didn't request it, and lord knows I've tried to stay away long enough (since the VB6 days). But, being a developer with a background in linguistics, I began to read through the issues. C# looks interesting, and I'll probably play with it some, but for the most part all of it just reminds me why I'm a ColdFusion developer with skills in related web type languages (XHTML, CSS, JavaScript, etc).

Last week I received my August issue of VSM, and took a look when I got a chance. I got a number of surprises with this issue, the first one being the biggest. In the front of magazine is an 'Online Contents' section, where they list articles that are only available on the web from three Redmond Developer Network sites: Visual Studio Magazine, Redmond Developer News, and Application Development Trends. And, to my surprise, under the articles on ADT, the first heading read Adobe Releases First Beta of ColdFusion 9.

Now, here's a magazine dedicated to .NET development, pointing to sites dedicated to .NET development, highlighting an article about ColdFusion. Nice! This was obviously part of the interview blitz that Adam Lehman did just before the public release. The article talks about ColdFusion Builder, quotes the recent Gartner Report, and talks about the great new features in ColdFusion 9, with emphasis on Hibernate, full scripted dev support, as well as the Office and Sharpoint integration features (it also reminds readers about the .NET and Exchange integration features added in to CF 8.)

So, it was truly cool to see CF getting some love from the press. More so, being as the press targets a different developer market. But, it got cooler for Adobe with the rest of the issue. See, this issue of VSM was also the 2009 VSM Readers Choice Awards. Adobe took a few honors in several categories:

  • Help Authoring: Readers Choice Award Winner : RoboHelp and RoboHelp Server - Adobe Systems, Inc.
  • Web Design & Development Tools : Readers Choice Award Winner : Dreamweaver - Adobe Systems, Inc.
  • Web Design & Development Tools : Readers Choice Merit Award Winner : Creative Suite 4 - Adobe Systms, Inc.
  • Web & Mobile Development : Editors Choice Award Winner : Dreamweaver - Adobe Systems, Inc.

Great news for Adobe, and a nice shot over the MS bow. Looking over the other categories, I see potential with the release of ColdFusion 9. Here's some nice goals/targets for our favorite server:

  • Charting and Multimedia (should've been Flex hands down, but CF has it's own)
  • Data Editing, Reporting & Analysis Tools
  • Grid Components: Web (I can see it)
  • Imaging and Graphics
  • Middleware & Server Based Tools
  • PDF Tools
  • SharePoint Components & Tooling
  • Editors Choice: Most Valuable Tool
  • Editors Choice: Data Handling & Development

Thanks Adam, for pushing the tech press in areas that haven't historically gotten our message. Congrats to Adobe for it's new honors, and here's to hoping other dev communities begin to see, and recognize, the value of ColdFusion.

Request vs Variables - Which is right?

Last week I stirred the pot a bit, stating that we've been improperly using the VARIABLES scope, and it's hurting our applications. Variables placed within the VARIABLES scope do not appear to have proper Garbage Collection performed on them when we're done with them, except in the case of the scope's usage within a CFC or a custom tag. This brought up some interesting discussion, where Ray Camden, Mike Brunt, and others chimed in.

I, with very good success, have been using REQUEST where most people use the VARIABLES scope. Wait! Hold on! You have to let me finish first before you get bent. What I said was that, in the past, we placed variables into the VARIABLES scope within our base request templates, with no way of clearing those variables at the end of the request (if using Application.cfc). My thought is, if VARIABLES have no true (apparent) mechanism for release, in context of variables scoped this way in a base request, then they don't really belong in the VARIABLES scope, but rather in the REQUEST scope.

This was met with some push back. The first argument was that this breaks encapsulation. I want to begin my response here by saying the first obvious thing that comes to mind: ColdFusion is not OO! Sure, your ColdFusion application can be written in an OO fashion, but ultimately it doesn't have to be. There are even some who seem that think that maybe it shouldn't be. All of that being said, I agree with OO principles, and think that proper encapsulation is very important when developing your applications, especially in terms of portability and reuse. Just because the REQUEST scope can be used directly within your custom tags or CFC's doesn't mean that you should. I would never suggest referencing the REQUEST scope directly within a CFC, with the exception of Application.cfc itself.

So another argument was that the REQUEST scope should only be used "when (and only when) the variable must be accessible to all the elements composing the request...", going further to state that the REQUEST scope should be avoided if at all possible. Why? The rest of the argument once again comes back to encapsulation. My point is to use the REQUEST scope within the context of a request, paying attention to maintain encapsulation. Within that context, doesn't it make sense to use the REQUEST scope for variables that should only exist for the length of a request?

The ColdFusion Jedi piped in to correct me on my timeline of scope introductions to ColdFusion, and we had some back and forth over declaration of scope to clearing of scope. I contended that onApplicationEnd() cleared the APPLICATION scope, that onSessiondEnd() cleared the SESSION scope, and that onRequestEnd() cleared the REQUEST scope. Ray reminded me that Application.cfc was about application process, and that the server handled when to 'clear' variables 'under the hood.' My point back was that something has to tell the server when to de-reference these variables, and that I had always assumed that was triggered by the execution of these methods. Mike Brunt chimed in on this, saying that the application must de-reference the variables prior to the server knowing it can perform Garbage Collection on them (Side Note: he didn't come out and agree with all of my conclusions here, only seeming to agree with the logic applied.)

Possibly the largest argument overall relates to whether the apparent memory leak, when using the VARIABLES scope within a base request, is really a leak or just a byproduct? I've theorized that the intention of the VARIABLES scope was that it was to be used only within CFC's and custom tags, where it does appear to properly get de-referenced. I put out there that the only reason you were able to use VARIABLES within the base request was because custom tags were created from .cfm files as well, so there really isn't any way to restrict it's usage. Ray says that the VARIABLES scope was introduced to provide access (like StructKeyExists()) to the unscoped variables out there in the wild.I think our thoughts of 'best practice' usage should follow these lines: Using the REQUEST scope within the base request, while maintaining encapsulation.

Ultimately, I just don't know. Maybe there's still an Adobe engineer out there who goes back that far, and can remember exactly what's what and why. I do know that, after migrating several high traffic applications to these guidelines I did get a higher return on application performance. I've gotten notes from others, after reading the original post, who have done similar changes to their systems with the same improvements. What other pluses or minuses do you, dear reader, think of when considering this practice of variable scoping? Is it right? Is it wrong? Is it a sin? What do you say?

(You can follow the original comment thread by referencing the post linked below)

Scope Usage and Application Scaling

Mike Brunt has posted an excellent article called Good Practices For Scaling ColdFusion Applications, in which he speaks about the importance of memory management within ColdFusion applications, and calls out certain avenues of scope usage that every CF developer should pay attention too.

Great post Mike! Another 'scope' issue that I've often seen (and abused myself) is the misuse of the VARIABLES scope. Back in the early days of CF, every example you saw showed an unscoped variable, placing it into the VARIABLES scope by default. This was fine, back then, as your view layers primarily consisted of Custom Tags. Use of the VARIABLES scope, within a custom tag, was permissable as those variables were then only available within that tag (or within a nested tag, if the nested tag used the CALLER scope). Once execution of the tag was completed, the memory space of those variables was cleared.

But, since custom tags were made from .cfm templates, there is no constraint within CFML from placing VARIABLES scoped variables within any .cfm template. This, in itself, is bad, as the VARIABLES scope (in the case of a base template, not a custom tag) is not properly cleared from memory space.

What I find people doing (and I've done it myself) is using the VARIABLES scope in place of the REQUEST scope. Memory allocated to REQUEST variables is properly recovered at the end of a request. Although variables in the VARIABLES scope are no longer available (except within a persistent CFC), their memory isn't properly released at the end of request execution. (For more information on this, see Jason Sheedy's post on the ColdFusion Memory Leak, and the accompanying comment thread and other referenced posts.)

A technique that some used, to get around this issue, was to have a StructClear(VARIABLES) statement as the last line of their onRequestEnd.cfm. This would explicitly clear out the VARIABLES scope at the end of a request. But, with the advent of Application.cfc, this no longer became an option (if you use Application.cfc.) If you tried to use that statement within the onRequestEnd() method of Application.cfc, you would only be clearing the VARIABLES scope of the CFC itself, and not the request.

That's actually a good pointer at the true underlying issue: proper scope usage. Use of the VARIABLES scope within a CFC makes variables within that scope only available directly by all methods of that CFC. Use of the VARIABLES scope within a custom tag makes variables within that scope only available within that tag (or a nested tag using the CALLER scope to access them.) Within a custom tag, you can not access variables of the calling template's VARIABLES scope, unless you use the CALLER scope to do so (which should only be in the case of a nested custom tag). You can, however, access REQUEST variables through out the request, from within a custom tag, an include file, or even within a CFC (though I wouldn't suggest doing that one.) By confining the usage of the VARIABLES scope to within custom tags and CFC's, and properly setting request level variables within the REQUEST scope, you could better manage your memory usage and application performance.

I've personally seen major differences in application performance, both through Mike's advice on persistent scope usage, as well as what I've outlined above. Unlike Jason Sheedy though, I'm not very familiar with Java profiling tools, so I'll have to leave it up to someone else to test all of this for the scientific proof. I only know that it appears my applications are running better as I migrate them to this paradigm. What are your thoughts?

*** Post Revision 080609: 2230 hrs *** More revision to my comments than the post itself, but Ray, the ColdFusion Jedi himself, corrected me. According to Ray, the VARIABLES scope wasn't added until CFMX, so my supposition on the 'intention' of the VARIABLES scope was incorrect. You really have to read the comment thread to see the fun we're having;) Hopefully we'll find an answer. Cutter

CFQueryReader v1.2 - Critical Update Supporting ExtJS 3.x

I have updated CFQueryReader, addressing issues that had arisen with new builds of ExtJs 3.x. This new build should cover sporadic issues with loading a new Ext.data.Store. There is also a simple example of using Aaron Conran's DirectCFM Ext.Direct ColdFusion API stack.

The CFQueryReader Example Site has been updated as well. You can update CFQueryReader from RIAForge.

Previous Entries / More Entries