CFUnited Session Review: Success from the Trenches - Building Better Applications, by Simon Horwith

 
Jul 02, 2007

by Doug Boude, CFUnited Correspondent

http://www.dougboude.com

I didn't have very high expectations when I walked into this session. The title seemed too ambiguous to hold the speaker to any real direction. But I invested the hour because like many other developers, I really want 'Success' and 'Better Applications.' The session actually did have a very clear direction and content. I came away from Simon's presentation more empowered than I was when I walked in.

Simon began with what it means to achieve success on a web development project. The metrics he uses to measure this are:

  • scalability - how does the end result operate under ever-increasing load?
  • Reliability - does the application work all the time, as opposed to accumulating "frequent crasher miles"
  • Extensibility - is it relatively easy to make changes to the application codebase?
  • Timelines - did we deliver the application within the timeframe we promised it?

We were immediately immersed in the topic of Good Code Efficiency and inundated with useful, practical information. For instance, since Coldfusion is built upon Java, Simon explained the Java-centric subject of garbage collection. This is how the server frees up memory no longer in use, a very important action that improves performance. Through illustrations, Simon explained the process, then used the concept as a springboard to show why declaring private variables with the var keyword is more than just a good thing to do: it has a direct impact on how efficient garbage collection behaves.

Another very good point Simon shared was the SE factor: search engines, and the impact they can have on code that isn't written with them in mind. For example, if you have code that consumes a lot of resources, like multiple object creation, setting of complex session variable values, etc, search engine spiders and bots can potentially bring your server to its knees in very short order. Every time a bot or spider visits your site, it creates a new session. If your site gets medium to high traffic, and you have heavy initialization code, search engines will become your nemesis.

Simon also touched upon the great value of using CFIMPORT to import your custom tag libraries rather than call them, just for the amount of file I/O you can save. Using CFSCRIPT reduces the amount of whitespace returned by ColdFusion to the browser! This, in turn, reduces the size of the packet returned and thus the speed of the page load.

Another very interesting concept that Simon introduced is resource pooling. Picture, if you will, an e-commerce site that uses a shopping cart object for each shopper. Simon's idea is this: upon application instantiation (which is one-time), create a pool of say 100 instances of the shopping cart object and persist them in the application scope. When a user needs a cart, assign them a publicly available cart. By doing this, you remove the overhead and time needed for object instantiation, which up till version 7.02 is fairly resource-intensive. Simon has written a "resource pool manager" and he said it is available on his blog, if you're interested in pursuing this methodology.

A few other notable tips:

  • Take care how much you rely on web services, as you will always have the additional time required by the HTTP call and the responsiveness of the remote server;
  • As much as you are able, make sure your database is tuned (low level admin stuff) and so is your ColdFusion Server (default settings out of the box are rarely your optimum configuration!);
  • and use CSS/XHTML as much as possible, as doing so leverages the client's browser's caching abilities as well (the same page set up with CSS versus one set up with tables loads signficantly faster).

Simon, my hat's off to you for making the hour invested with you an hour VERY well spent!


Having spent four years disarming bombs for the Air Force, Doug Boude is now a Senior Web Application Architect for Fiserv Health in San Antonio, TX. He has been developing with ColdFusion since version 4.0.

Add a Comment
(If you subscribe, any new posts to this thread will be sent to your email address.)
  
Privacy | FAQ | Site Map | About | Guidelines | Contact | Advertising | What is ColdFusion?
House of Fusion | ColdFusion Jobs | Blog of Fusion | AHP Hosting