> "Well, the generally accepted "best practice" is that CFCs 
> should *not* output anything..."
> 
> WHY???  
> 
> I understand why one would not want to mix display 
> functionality with other layers of logic, and I am trying to 
> learn how to separate my coding along these lines.  But 
> nobody has explained to me why it is "inherently" bad to do 
> display in a CFC as long as that is the purpose of that CFC.  
> Is there something wrong with creating a display CFC for ones 
> view layer?

I don't think it's inherently bad, myself. However, I don't think it's
usually the most sensible mechanism for generating output. Custom tags are,
I think, a more natural approach for output generation within an HTML page.
Given that custom tags are arguably better suited to this task, why not use
them instead? What appears more natural, this:

<some_html_tag>
<cf_dosomething></cf_dosomething>
<some_other_html_tag>

Or this?

<some_html_tag>
<cfoutput>#someCFC.doSomething()#</cfoutput>
<some_other_html_tag>

Interestingly, this is more or less the approach taken by other enterprise
web application environments, like ASP.NET and J2EE. In ASP.NET, code-behind
classes are generally reserved for things other than presentation logic, and
you can build custom tags for presentation logic. In an MVC J2EE
application, you might use a servlet for the controller, beans and other
Java classes for business logic, and JSP pages for the view, and JSP custom
tags to build parts of the view.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:229738
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to