If people put utility functions in CFCs I definitely recommend caching
these in RAM. However, what I see many people do is instantiating a
large CFC that consists only of functions, calling one tiny function
inside of it, then destroying the CFC, with no caching used at all.
The majority of ColdFusion programmers struggle with the concept of
CFCs and they don't use as much caching as they should. For the
majority of CF programmers, I think UDF libraries are the safer path
because they are harder to misuse and their use is less likely to
bring down a server. I don't think I have ever seen a UDF library
significantly impact the performance of a Web site. UDF libraries are
faster and use less server resources, although if you are caching CFCs
in the application or server scopes, the speed differences become
minor.

To clarify a possible misunderstanding, I'm not saying CFCs are bad.
Rather, I am contesting the phrase "ideal location" when it comes to
where to put functions. Using a UDF embedded in a cfm page or a
collection of UDFs in an include file is fine with me. Using a CFC is
fine with me as well, as long as attention is paid to the potentially
server-crippling impact of instantiating too many CFCs.

I wouldn't say that there is only one ideal way to structure a CF
application. If there was only one correct way to do things, that one
correct way would be both well documented and widely understood at
this point in ColdFusion's history. Instead of the phrase "ideal
location," the phrase "my preferred location in order to keep coding
styles consistent throughout the application" might be better.

-Mike Chabot

On Fri, Nov 12, 2010 at 8:04 PM, James Holmes <james.hol...@gmail.com> wrote:
>
> Why not create the CFC in the application scope to cache it in RAM?
>
> On 13 November 2010 06:22, Mike Chabot <mcha...@gmail.com> wrote:
>> I prefer using include files and caching common
>> functions in RAM when the application loads.
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:339177
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to