Hm, I respectfully disagree with putting functions in cfm pages entirely no
matter how it's being pulled. I think there's a place for functions and
that's in cfcs.

You say you have a lot of utility functions that don't need to be in a cfc.
If you have a lot of them, why not just create a cfc called utility and
stick them all in one cfc?

Also, if you stick functions and include them most likely your talking to
that function using scoped variables which as other have mentioned is
usually a bad practice to do using functions.

Paul

-----Original Message-----
From: Gerald Guido [mailto:gerald.gu...@gmail.com] 
Sent: Friday, November 12, 2010 12:54 PM
To: cf-talk
Subject: Re: Where to put your code


My only exceptions to these would be:


> Includes
>
> Should Not Contain: Application Logic. Processes or functions.
>

A lot of times (depending on the app) I stick functions  (UDFs) in an
include. I have a lot of utility functions that (arguably) don't really need
to be in a cfc.

Custom Tags
>
> Should Contain: Reusable,  Dynamic UI or presentation code. (IE
> generic headers that accept passed parameters for customization)
>


I generally use custom tags as views for encapsulation purposes. What
happens in Vegas, stays in Vegas. Then I stick the aforementioned functions
in the request scope or a stuct and/or array to pass into the views.

G!


-- 
Gerald Guido
http://www.myinternetisbroken.com

"Wait. We can't stop here. This is bat country."
-- HST




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:339146
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to