Archive for September, 2008
Friday, September 26th, 2008
Most programming languages have what are called static or class methods. The other kind of method available is instance or object methods. The difference between the two is that the former acts independently of any data members within the object. Thus it can be called in passing without instantiating an entire object in order to use a small chunk of code.
Apparently the Coldfusion developers have never heard of these differences. A tag called CFInvoke exists which would lead one to believe that this works like a static method call. The first volume of the official Coldfusion text book even hints at this by using it in this way. It even say, “… although rather than used, CFCs are said to be invoked.”
Well, not exactly. If you use CFInvoke on an uninstantiated object (by using the component path), it will instantiate it for you. Everytime. So instead of it being a memory saver, it wastes memory.
The proper use of CFInvoke is if you do not know what function will be called ahead of time and don’t want to have to have a switch statement for each potential function call.
Posted in Good To Know | No Comments »
Tuesday, September 16th, 2008
As mentioned on the House of Fusion. [310165]
An IsStruct() call will return true, not sure if in only some cases, when questioning that of a ColdFusion CFC object. Below is an example that uses the “cfcexplorer.cfc” that is located in the CFIDE. (as of 8.0.1)
<cfset obj = CreateObject("component",
"CFIDE.componentutils.cfcexplorer")
/>
<cfoutput>
IsStruct: #IsStruct(obj)# <br />
IsObject: #IsObject(obj)#
</cfoutput>
Posted in Uncategorized | No Comments »
Thursday, September 4th, 2008
Just a quick note to everyone trying to use XML in Coldfusion. Don’t use a “true” parameter in XMLNew(). Things will go haywire. Just use false and it manages to still retain all of the case sensitivity.
My hunch for why this makes things go haywire is that you cannot use the normal dot notation for accessing the sub-elements because CF capitalizes anything in the dot notation.
Another related note: don’t use the built-in XSLT processor. It sucks and isn’t fully implemented. Use cfexecute and get some sort of external XSLT engine. The one I’m currently using is Saxon. It’s slow, but it works.
Posted in Good To Know | No Comments »