| By Simon Horwith | Article Rating: |
|
| January 13, 2006 03:15 PM EST | Reads: |
12,924 |
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
Published January 13, 2006 Reads 12,924
Copyright © 2006 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Simon Horwith
Simon Horwith 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.
![]() |
SYS-CON Brazil News Desk 01/13/06 04:35:26 PM EST | |||
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 01/13/06 04:14:46 PM EST | |||
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. |
||||
- ColdFusion and AJAX
- i-Technology Viewpoint: We Need Not More Frameworks, But Better Programmers
- What's New with Flex, ColdFusion, and More
- New Adobe ColdFusion 8 Tools "Invaluable"
- Welcome the Arrival of Adobe and Web 2.0
- "Convergence Is Now Coming Alive" Says Jeremy Allaire
- Misconceptions and Myths About ColdFusion . . .
- "It's Here!" - Editor-in-Chief of ColdFusion Developer's Journal Introduces ColdFusion MX 7
- The Future of ColdFusion – Major Flex 2 Deployments Are On Their Way, Says CFDJ Editor-in-Chief
- ColdFusion Developer's Journal Special "Frameworks" Focus Issue: SAM
- CFDJ Product Review "CFMX Exam Buster 7"
- ColdFusion CFC Query in Dreamweaver




























