Watch What You Write, Someone Is Reading

Today I received the following comment here, on an older post on Variables and Naming Conventions:

...I wish Adobe would publish and adopt some kind of official naming convention. Sometimes reading sample code written in some other convention can make things harder to follow...
It was almost funny that this comment had come in when it had. Recently I was doing a lot of research for a User Group presentation I just did on the new ColdFusion 8 Ajax Components (have to re-record it before public release). In the process, I spent a great deal of time going over documentation all over the internet, from LiveDocs to countless blogs, absorbing the wealth of information that is already out there. It was outstanding that there were so many resources out there for people to learn from. On the other hand, it was a little sad that so much of the sample code was written in ways that can really start new developers off with some bad habits.

I'm not perfect, by any means, but I try to pay careful attention to the code that I place on this blog for readers to use and learn from. One thing that I attempt to do is pay attention to basic Web Standards, like using XHTML (the current standard) instead of HTML, keeping styles in the stylesheet, and having unobtrusive JavaScript. I don't always do it, sometimes it doesn't make sense for a quick example, but I try, especially within code downloads. I also try to adhere to my own Coding Guidelines, so that code appears to be consistent and easy to read and understand.

Probably the one that bothers me the most, and that I see most prevalent in blogs, documentation, and books, is the lack of proper variable scoping. I know that, often, we're just publishing quick examples, but this can be an extremely detrimental practice. I have worked on some very large enterprise applications, with years of code written by half-a-dozen different developers, most of whom learned their ColdFusion (and development) skills through the docs or a book. Many had actually come up with some very creative and effective algorithms to fix some issue, or create some new whiz bang feature, but their code was so poorly scoped that, after time, it could take down the server. Why? How? Enterprise sites may contain several hundred (or thousand) templates, containing dozens of variables on each page, and can potentially be hit by hundreds (or thousands) of users simultaneously. Multiply the number of variables by the number of pages by the number of users, then imagine ColdFusion doing a ScopeCheck on each one, to figure out which scope each variable requested belongs in. Even if the variable is in the VARIABLES scope, it's still that many times ScopeCheck will be called while rendering a page.

Still not convinced? Go download varScoper, and run it on your project root folder, including your subfolders, and see what it comes up with. Yeah, I'm still in shock. Cleanup on that is easier on a small subproject scale, but it's definitely forced me to think better when I'm writing my code, paying attention as I go, to minimize the performance impact of my applications, no matter how small it may be. I learned my bad habits from the docs, various books, sample code slung around on the CF-Talk list. I've continued to realize that there are better ways of doing things (like OOP and frameworks), and adjust my style and methods, and I think it's important to consider these 'best practices' when contributing. A little more code, but the right thing to do in the end, for you, your app, and your systems.

So, if you own a site of documentation, revise it. If you're writing a book, edit it. If you publish a CF blog, live it. The up-and-coming are reading us all of the time to find out how to use this wonderful language. Let's try to show 'em how to do it the right way. You might not follow any guidelines at all, within your development, but this scoping thing is way too important to gloss over, and will only help everyone in the long run.

Hey, where did everything go?

Ouch! I have no content. Guess I've been away too long. See, we have this FNG (Fairly New Guy, get your mind out of the gutter) in our office, working in our SEO/SEM department, who's been hacking away in PHP trying to make a few tools for their team. Since he wants to tap into our databases, and write tools that interface with the rest of our system, he is now going to start learning ColdFusion. Not much of a stretch, and I'm confident that, once he's into it, he's really going to enjoy himself. Anyway, I pulled up my blog today, to get him the links for setting up his dev environment, when I notice a big "Sorry" message on my blog's homepage. For shame! Sorry folks, I've been busy.

[More]

Where is Cutter?

Well, It's good to be back (so to speak). I had a nice bout of the stomach flu, and it was no fun. But now I'm back in the saddle and ready to go. I should post the next phase of my EXT UI DataGrid tutorial within the next few days, and I hope to get back to my Creating The View tutorial very shortly (next stop: Mach II).

This very minute, though, I'm sitting in the Nashville International Airport preparing to fly out for the weekend. My stepfather has been asking me, for half a decade now, to join him for the Indy 500. No reason to say no this year, so I'm waiting on a flight to Charlotte, North Carolina where I'll catch a connection to Dayton, Ohio. We're going to check out a few things in John's hometown before making the trip in Sunday for the race. I personally have never been a huge racing fan, but the Indy 500 is an event. It would be kind of like turning down a trip to the Kentucky Derby, the World Series, or the Super Bowl. So, I'm in for the new experience and little time with my step dad.

Which is interesting in regards to my DataGrid tutorial. IndyCar.com is highlighted on the home page of Jack Slocum's Ext JS UI library as a site that uses the javascript components extensively, sporting a cool AJAXified interface that provides real time racing data during Indy races.

So, I'll try to knock out the next installment of my DataGrid tutorial while I wait around in airports. See if I can get this train moving again. I'll also fill you in on the fun of the weekend as I go along.

Scorpio Tour: Nashville

Ben's visit is quickly approaching, and every stop on the tour (so far) he's announced another exciting new feature in our favorite platform. Aaron came out of his office today to announce that the giveaways are getting even bigger. Aside from raffling off a Scorpio license (to be given upon release), we'll also be giving away a copy of Flex Builder with Charting!

[More]

Welcome MXNA and Fullasagoog

I want to welcome new readers from MXNA and Fullasagoog. I hope that there is a little something here for everyone. You can read my Welcome post for a little more about what you might find here at Cutter's Crossing, and you can check out Who I Am for a little more information about me and what I might bring to the blogosphere. Again, welcome one and all, happy reading, and let me know what you think.

Moving On Up

OK, well I've made the jump to BlogCFC 5.5.002. Can I tell you that it is almost impossible to keep up with Ray Camden. The man is a fiend. I have no idea how he finds the time to manage his job, family, side work, and tons of open source projects. The guy is truly amazing. Thanks again, Ray, for everything you do for the CF Community.

As some of you can tell, I will have to look into a few changes now. I'm using the 'liquid' layout here, so some adjustments will be needed to handle the graphic at the top of the page. But that, my friend, is for another time.

I'm also going to incorporate a new 'about' pod that Charlie Arehart has sent to me. We've been going back and forth in email on some common interest stuff, and he pointed out to me that I don't have any sort of 'identifier' on my blog. This new pod will be great. Thanks a lot Charlie!

The Unintentional Connection

Ok, so my co-worker, Ben, decided to Google Cutter's Crossing to see what would come up (hadn't thought of that). What he found was am obscure reference within a script for a "Knight Rider" episode:

[More]

Previous Entries