Tuesday, February 09, 2010    
Home My Books Blog ColdFusion About Me Back    

Calendar
<< Feb 2010 >>
S M T W T F S
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28            

Search

Categories
 • Acrobat (3) [RSS]
 • Adobe (88) [RSS]
 • AdobeMAX06 (45) [RSS]
 • AdobeMAX07 (59) [RSS]
 • AdobeMAX08 (66) [RSS]
 • AdobeMAX09 (39) [RSS]
 • AdobeMAX10 (1) [RSS]
 • AIR (215) [RSS]
 • Appearances (190) [RSS]
 • Books (72) [RSS]
 • CFEclipse (15) [RSS]
 • ColdFusion (1371) [RSS]
 • Data Services (33) [RSS]
 • Fish Tank (4) [RSS]
 • Flash (179) [RSS]
 • Flex (493) [RSS]
 • Home Automation (4) [RSS]
 • Jobs (116) [RSS]
 • JRun (14) [RSS]
 • Labs (43) [RSS]
 • LiveCycle (34) [RSS]
 • MAX (232) [RSS]
 • Mobile (109) [RSS]
 • Regular Expressions (17) [RSS]
 • RIA (19) [RSS]
 • SQL (40) [RSS]
 • Stuff (532) [RSS]
 • Tips (CF Studio) (80) [RSS]
 • Tips (CF) (795) [RSS]
 • Tips (Dreamweaver) (91) [RSS]
 • Tips (Flex Builder) (2) [RSS]
 • Using CF (161) [RSS]

Other BLOGs
 • Charlie Arehart
 • Lee Brimelow
 • Ray Camden
 • Christophe Coenraets
 • Sean Corfield
 • Mihai Corlan
 • Cornel Creanga
 • Mark Doherty
 • John Dowdell
 • Danny Dura
 • Enrique Duvos
 • Steven Erat
 • Kevin Hoyt
 • Serge Jespers
 • Adam Lehman
 • Duane Nickull
 • Miti Pricope
 • Andrew Shorten
 • Ryan Stewart
 • James Ward
 • Greg Wilson
 • Full As A Goog

RSS Feeds
 • Feed
 • Subscribe

Join my mailing list and find out about new books and other topics of interest.

Thoughts, ideas, tips, musings, and pontifications (not necessarily in that order) by Ben Forta ...
NOTE: This is my personal blog, and the opinions and statements voiced here are my own.

Viewing By Entry / Main
February 2, 2004

Custom Tags Versus CFCs

It is possible to write an entire ColdFusion application using just Custom Tags (and a single file as an entry point). Similarly, it is possible to write an entire ColdFusion application using just .cfc files (I've yet to see one of these, but it is doable). So, when should Custom Tags be used? And when should .cfc files be used? Where is the logical spilt between them?

While in London last week, I got into an interesting discussion on just this subject with Simon Horwith (initially at a customer site, and continued the next day at a local Starbucks). The truth is that there is a lot of overlap in the capabilities of Custom Tags and ColdFusion Components, and I don't believe there is an absolute right or wrong here, but, here's what we agreed on ...

CFCs are best-suited for data abstraction, for business logic and transaction encapsulation, for processes, for doing stuff. While CFCs can indeed be used to generate and even display output, that is not their core strength. CFCs provide basic object type functionality (not true objects, I know, I am not going to get into that discussion here), and are best used where objects would typically be created and used. That is not to say that CFC methods should never render output, they may (although I'd want specific methods, or inherited CFCs to be used for this). But that is not where they add real value to ColdFusion development.

Custom Tags, however, are perfect for presentation and data formatting. In fact, that is what they are best at (they are only used for everything else because CFCs were first introduced in CFMX, we used Custom Tags because we had no better option). The syntax, the use of tag pairs and child tags, multiple execution modes, the simplified attribute passing, all of those make Custom Tags perfect for wrapping around content so as to present it as needed. And the lack of multiple entry points, the lack of formalized parameter passing, the lack of persistence and inheritance, all of those make Custom Tags poor choices for data and logic abstraction.

So, CFCs for logic and data abstraction, Custom Tags for presentation, and good old .cfm files to hold it all together. Considering capabilities, usability, and performance, that seems like the best combination to us. If you have another opinion I’d love to hear it.

TrackBacks
There are no trackbacks for this entry.

No trackback URL. Trackbacks are only allowed via interactive form.

Comments

  © Copyright 1997-2009 Ben Forta, All Rights Reserved