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.

Yes, I Am King!

Well, this was fun! Thanks Aaron.

NerdTests.com says I'm an Uber Cool Nerd King.  What are you?  Click here!

Cutter As A Simpson's Character

Well, I've had this on my desktop for two weeks now, so I thought it was time to share. Not entirely accurate. They didn't have any hawaiin (that's not spelled right) shirts on the avatar maker. And where's the props? I need a mic!

The 91st Indianapolis 500

Wow! Ok, I'm not a big race fan. Races have two real moments of big excitement, the start and the finish. Other than the occasional wreck it's a bunch of cars going around in circles. Well, that's how I thought.

[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]

The Current ColdFusion Job Market

I found myself, again, at a crossroads. Recently I decided to update my resume. I had accounts on Dice, Monster, CareerBuilder, and ComputerJobs from my last job search, so I decided it couldn't hurt to keep them up to date. I had been in my current position for sixteen months, learned a few things, accomplished various goals, and thought it would be a good idea.

[More]

The State of Cutter

Well, it's been a busy year already. I've been working on the largest code rollout in the history of our company. 250+ templates in all. I'm thankful that we hired another senior developer in Andy Matthews, a great guy whom I already knew from our Nashville ColdFusion User Group. Although the initial project was in support of a new project relating to statistical usage reporting, encompassing user and session management, we have also begun a full scale rewrite of our session and application initialization. No small task with our system, and something that will be further enhanced in the coming year as we finalize our migration from ColdFusion MX 6.1 to 7.

[More]

Developer Persona: Cutter

Per Tim's suggestion:

  • 37 Years Old
  • Lives in Nashville, Tennessee
  • Former Army
  • Drives a 2006 Chevy Cobalt
  • Rents an apartment, while working towards a house
  • Married to SuperWife, Teresa, with 5 year old Diva Girl daughter, Savannah
  • Likes to read Stephen King, Tony Hillerman, murder mystery thriller mayhem and things that go bump in the night. Gets to read fiction maybe twice a year.
  • Battlestar (with the wife), Smallville (with the daughter), Heroes (for me)
  • Loves to sing, misses fronting 'The Band'
  • Favorite Book: To Kill A Mockingbird
  • Favorite Musician: Jimi Hendrix
  • Loves movies, but rarely goes to the theater
  • Listens (and sings) to everything from Nickelback to Nat King Cole, with strong leaning towards classic rock and the blues
  • Captain and Coke

Field Of Stones

Many years ago, probably while stationed at NSA, I sat down and wrote this poem while coming up with content for the 741st MI BN's newsletter, for their Memorial Day edition. Since then it has also appeared in the Ocean View, DE American Legion newsletter, the Ocean City, MD Veterans of Foriegn Wars newsletter, and an abbreviated version on Poetry.com. I thought the content was still fitting for this Veteran's Day, a gentle reminder to thank all of my brothers and sisters-in-arms who put their lives on the line in the name of freedom.

[More]

More Entries

BlogCFC v. 5.8.001 was created by Raymond Camden. Layout inspired by bluerobot.com., with some JQuery thrown in for fun.