ColdFusion Singletons
Singletons are perhaps one of the most simple Design Patterns. For those who don't know sigletons are a class that can only have one instance. They can be thought of as a glorified global variable - but are a lot more useful.
Most ColdFusion classes, or rather instances of CF components, can be turned in a singleton by placing the following code in your Application.cfm:
1<cfif not structkeyexists(application,<instance name>)>
2 <cfset application.<instance name> = createobject("component",<path to component>)>
3 </cfif>
2 <cfset application.<instance name> = createobject("component",<path to component>)>
3 </cfif>
or OnApplicationStart method of your Application.cfc:
1<cfset application.<instance name> = createobject("component",<path to component>)>