sahil wrote: help
Oct. 14, 2008 07:57 AM
|
YOUR FEEDBACK Did you read today's front page stories & breaking news?
SYS-CON.TV SYS-CON.TV WEBCASTS |
TOP COLDFUSION LINKS ColdFusion News Desk Simon Horwith's ColdFusion Blog: Using Includes in CFCs
Several people, Sean Corfield and Joe Rinehart most notably, have been blogging and emailing lists
By: Simon Horwith
Jan. 13, 2006 03:15 PM
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 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 I'm still waiting for someone to give me an example where using YOUR FEEDBACK
CFDJ LATEST STORIES . . .
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
|
SYS-CON FEATURED WHITEPAPERS MOST READ THIS WEEK |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||