| By Simon Horwith | Article Rating: |
|
| January 13, 2006 03:15 PM EST | Reads: |
12,722 |
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,722
Copyright © 2006 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
About 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. |
||||
- AJAX World RIA Conference & Expo Kicks Off in New York City
- Ulitzer’s Amazing First 30 Days in Public Beta
- "Government IT Expo" to Highlight Cloud Computing and SOA
- Will Ulitzer Dominate News Content on The Web? -Gartner
- Clear Toolkit 4: The Road Map
- Creating Adobe AIR Native Menu with Flash CS4
- Ulitzer Responds to Published Reports
- Ulitzer vs. Ning - a Quick Review
- Adobe AIR: Creating Dock and System Tray Icon Menus
- Social Media Terrorists
- AJAX World RIA Conference & Expo Kicks Off in New York City
- Web Services Using ColdFusion and Apache CXF
- Adobe Takes LiveCycle into the Cloud
- Ulitzer’s Amazing First 30 Days in Public Beta
- Adobe Creates a Sandbox in the Sky
- "Government IT Expo" to Highlight Cloud Computing and SOA
- Will Ulitzer Dominate News Content on The Web? -Gartner
- The Role of an RIA in the Enterprise
- Clear Toolkit 4: The Road Map
- Creating Adobe AIR Native Menu with Flash CS4
- The Next Programming Models, RIAs and Composite Applications
- Constructing an Application with Flash Forms from the Ground Up
- AJAX World RIA Conference & Expo Kicks Off in New York City
- CFEclipse: The Developer's IDE, Eclipse For ColdFusion
- Personal Branding Checklist
- Adobe Flex 2: Advanced DataGrid
- i-Technology Viewpoint: We Need Not More Frameworks, But Better Programmers
- The Asynchronous CFML Gateway
- Building a Zip Code Proximity Search with ColdFusion
- Web Services Using ColdFusion and Apache CXF






































