YOUR FEEDBACK
sahil wrote: help
AJAXWorld RIA Conference
October 20-22 San Jose, CA
Register Today and SAVE !..


2008 East
DIAMOND SPONSOR:
Data Direct
Frontiers in Data Access: The Coming Wave in Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
Intel
Virtualization – Path to Predictive Enterprise
Green Hills
IT Security in a Hostile World
JBoss / freedom oss
Practical SOA Approach
GOLD SPONSORS:
Software AG
The Art & Science of SOA: How Governance Enables Adoption
PlateSpin
Effective Planning for Virtual Infrastructure Growth
Fujitsu
Automated Business Process Discovery & Virtualization Service
Ceedo
Workspace Virtualization
Click For 2007 West
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
SYS-CON.TV
TOP COLDFUSION LINKS


Simon Horwith's ColdFusion Blog: Using Includes in CFCs
Several people, Sean Corfield and Joe Rinehart most notably, have been blogging and emailing lists

Several people, Sean Corfield and Joe Rinehart most notably, have been blogging and emailing lists talking about the pros and cons of using cfincludes in CFCs. Sean is opposed to it, as am I, but Joe's got some mixed feelings. In a rush I simply commented on Sean's blog that this is bad form and defeats the purpose of Components. Joe'd like me to elaborate, so I will.

I should begin by stating something that many of you may be surprised to hear - I don't use ... EVER! The methodology I use, which I promise you'll all be able to read very soon, encourages breaking everything down to parameterized encapsulated modules. Code within a is neither encapsulated nor parameterized. It's unprotected and not as robust, either. I use Custom Tags for all UI elements and CFC methods for all business logic. Presentation tier logic also goes in my tags.

When ColdFusion Components were introduced to CFML several years ago (with the release of CF MX 6), they brought a whole new level of encapsulation to the language that is far more robust than anything we had before. I won't go on and on about the benefits of CFCs - let's just say, to keep things simple, that they introduced all the benefits of Object Oriented languages to CFML. There are some basic rules of OOP that I firmly believe in and apply to CFC use. One is that all business logic belongs in CFC methods. Another is that CFCs don't ever display anything - their methods are data in and data out. Given those two facts, what good can come from using an include within a CFC method? If the thing being included contains business logic then that code should be in a method. If anything, this is more reusable than having it in an include file. If the thing being included generates output, it's OK for that code to talk to CFCs but should never be used by a CFC (since they shouldn't be writing to the screen).

Whether or not you agree with the notion that CFCs should never write to the screen or with the idea of never using at all in your applications, is irrelevant. CFCs are encapsulated and parameterized - all of the data and functionality that a CFC needs should either be contained inside that CFC or inside of another CFC(s).

I'm still waiting for someone to give me an example where using inside of a CFC makes more sense than having all of your logic in components. The talk between Joe and Sean began when Joe started looking at Mixins in CF (Go read his post at http://clearsoftware.net/index.cfm?mode=entry&entry=BC62A7BA-E081-2BAC-690DA2E20D609568 for more on that). Mixins appears to me like a convoluted way to implement the Aspect Oriented Programming technique of 'weaving'. Weaving aspects is an interesting idea, but I wouldn't choose to use in order to implement it. How would I implement it? I think I'll save that for another day, since this entry is pretty long already, but if anyone out tere would like to see me implement AOP in CFML, I don't mind doing it.

About Simon Horwith
Simon Horwith is the editor-in-chief of ColdFusion Developer's Journal and is the CIO at AboutWeb, LLC, a Washington, DC based company specializing in staff augmentation, consulting, and training. Simon is a Macromedia Certified Master Instructor and is a member of Team Macromedia. He has been using ColdFusion since version 1.5 and specializes in ColdFusion application architecture, including architecting applications that integrate with Java, Flash, Flex, and a myriad of other technologies. In addition to presenting at CFUGs and conferences around the world, he has also been a contributing author of several books and technical papers. You can read his blog at http://simon.coldfusionjournal.com.

YOUR FEEDBACK
SYS-CON Brazil News Desk wrote: Several people, Sean Corfield and Joe Rinehart most notably, have been blogging and emailing lists talking about the pros and cons of using cfincludes in CFCs. Sean is opposed to it, as am I, but Joe's got some mixed feelings. In a rush I simply commented on Sean's blog that this is bad form and defeats the purpose of Components. Joe'd like me to elaborate, so I will.
SYS-CON Belgium News Desk wrote: Several people, Sean Corfield and Joe Rinehart most notably, have been blogging and emailing lists talking about the pros and cons of using cfincludes in CFCs. Sean is opposed to it, as am I, but Joe's got some mixed feelings. In a rush I simply commented on Sean's blog that this is bad form and defeats the purpose of Components. Joe'd like me to elaborate, so I will.
CFDJ LATEST STORIES . . .
Kevin Lynch, who will be keynoting on October 21, 2008, helped originally coin the term "Rich Internet Application" in 2002. He has been at the center of innovation in Flash and Adobe AIR since their inception, and currently drives Adobe’s technology platform for designers and develo...
Rich Internet Applications offer the potential to fundamentally change the user experience and in doing so, yield significant business benefits. The theme of this October's AJAX World Conference & Expo 2008 West is 'Beyond AJAX to the RIA Era' and the Call for Papers, which is still op...
Join Scott Guthrie as he discusses Microsoft’s commitment to web standards development, Rich Internet Applications and how Microsoft is contributing to help move the web forward. Join Adobe’s Kevin Lynch as he demonstrates how Flash and HTML come together to make the most engaging,...
Virtualization has become a critical part of Enterprise IT strategy. Why and how has it become one of the most important change agents in our industry? To answer these questions I had the good fortune recently to be able to speak to a select group of top IT industry executives who join...
SQL Injection attacks are one of the easiest ways to hack into a website. One recent hack, using a script from verynx.cn, involves injecting sql into a web form that then appends some JavaScript code into fields in a database that then gets executed on the client side when a user views...
Recursion Software released a private beta version of their Voyager mobile platform, with powerful interoperability for Android, Microsoft .NET and Compact Framework (CF), all Java editions (JME CDC, JSE and JEE), and more than 15 embedded operating systems. The Voyager platform is a p...
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON FEATURED WHITEPAPERS

MOST READ THIS WEEK
ADS BY GOOGLE