In my option, putting functions and application logic in cfm files,
include files, and custom tags is fine. The vast majority of
ColdFusion Web sites allow developers to do this and I think adding
these restrictions could lead to a worse outcome. If you hire an
expert developer, and that expert developer thinks it is best to
encapsulate some complex network communication and XML processing
logic inside of a Java custom tag, then I think the best action is to
let him do it instead of making him conform to some unnecessary
restrictions.

If you have a collection of utility functions, my recommendation is to
not put these into a CFC because CFCs add overhead without adding
much, if any, benefit. I prefer using include files and caching common
functions in RAM when the application loads. If CFCs behaved more like
objects in an OO language and did not have the overhead that they
have, my opinion might be different. In at true OO language, I put
functions into objects without hesitation.

-Mike Chabot

On Fri, Nov 12, 2010 at 10:23 AM, Paul Alkema
<[email protected]> wrote:
>
> Hi All,
>
> I recently had a discussion with some other programmers on my team dealing
> with where to put application code and when. This is a small little guide I
> wrote that I try to use and I wanted some second opinions on my coding
> logic.
>
>
>
> Thanks,
>
> Paul
>
>
>
> ----------------------------------------------------------------------------
> -----------------------------------------
>
>
>
> When to put your code where. In my opinion this is the IDEAL location for
> code.
>
>
>
> Straight on CFM Page
>
> Should Contain: UI or presentation code. HTML, JavaScript, simple ColdFusion
> (IE; does var.foo exist output etc..).
>
> Should Not Contain: Application Logic. Processes or functions.
>
>
>
> Includes
>
> Should Contain:  Code should contain same type of code as CFM pages however
> includes should be used to split large CFM pages into smaller segments.
>
> Should Not Contain: Application Logic. Processes or functions.
>
>
>
> Custom Tags
>
> Should Contain: Reusable UI or presentation code. HTML, JavaScript, simple
> ColdFusion. Code that's going to be used more than once.
>
> Should Not Contain: Application Logic. Processes or functions.
>
>
>
> CFC's
>
> Should Contain: Application Logic. Processes or functions.
>
> Should Not Contain: UI or presentation code

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

Reply via email to