I have definitely moved to using tags for render-side (i.e.: "view") stuff and CFCs for most of the rest on the backend.

Having a one-to-one doesn't, on face, make a lot of sense to me, but to each their own.

I find tags are still extremely useful for encapsulating things like form fields, page layouts, client validation, page-level and content-level security (often using a "service" from a CFC internally).

In the end, I think it's largely a style question as to whether you like having CFCs that render HTML (assuming you are well separated in that regard from your logic) or custom tags or just plain HTML, though when it comes to wrapping chunks of code (i.e.: end tags) nothing else comes close to the ease of custom tags.

When I taught my intro to CFCs class I gave the following bullets on CFCs vs. tags (keep in mind this is for a non-OO crowd):

Choose Components When:
You have a single data object that needs multiple actions
You want to maintain an object-style syntax
You want to have stateful data and/or cache the functionality in memory
You will want to use the functionality inside CFSCRIPT or in expressions

Choose Custom Tags When:
You want to encapsulate page-level or content-level complexity
You want a non-programmer to easily use the functionality
You need to create a single "black box" of functionality
You want to wrap other functionality with start/end tags or want use child tags

CFCs and custom tags work great together -- just different styles and different strengths. Right tool for the right job, blah blah.


Baz wrote:
So we know that everyone encapsulates logic in CFCs - how often does
everyone use TAGs? Simon Horwith said that now his pages are composed 100%
of CFC and TAG calls - no HTML, no functions, no nothing - just CFCs and
TAGs. In fact, he usually creates at least 1 TAG for every CFC and passes
the CFC to the TAG for display...

Thoughts?

Baz





----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at 
www.mail-archive.com/cfcdev@cfczone.org






----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at 
www.mail-archive.com/cfcdev@cfczone.org


Reply via email to