On Thu, 3 Mar 2005 11:43:09 -0500, Michael Dinowitz <[EMAIL PROTECTED]> wrote: > I'm starting this topic to get peoples feelings on the subject. Do you use > CFCs for UI? Do you have a good reason to do so? Do you see a reason to use > it (or not) vs. CFINCLUDEs or CFMODULEs?
Anyone who uses Mach II is using CFCs to generate their UI whether they realize it or not. Mach II has a CFC dedicated to rendering a view (and it <cfinclude>s the view .cfm page). It also manages the optional use of <cfsavecontent> to place generated output in content variables. > According to commonly discussed practices in the community (and in part of > the Macromedia docs), UI elements should not go inside of CFCs. > According to the Macromedia CFC examples, UI can go inside CFCs. > According to the makeup of the CFCOMPONENT and CFFUNCTION tags, the ability > exists explicitly (the output attribute). > According to many of the OO books I've been reading, there's no reason for > UI not to be within an object. Most typical OO systems have a UI that is built with objects that you interact with to render your data. In those systems, the 'system' maintains the UI model and your application simply calls methods on it - and sometimes registers objects that are invoked for UI operations. That model doesn't apply as well to web apps - you get a request, you generate HTML, you spit it back out. A Servlet app is OO and calls methods to write HTML to the response object but a JSP app hides that and gives the impression of rendering HTML directly. CFML follows the same model. The idea that CFCs shouldn't generate HTML is mostly based on the separation of business logic and presentation - so if you have pure presentation CFCs that contain no business logic, you're not breaking any "rules". But usually it's just easier to recommend that folks use custom tags and CFML pages for UI and CFCs for model stuff. Because of ColdFusion's page-based underpinnings, which hides the real Servlet model underneath, it can be pretty ugly to work with CFCs for general UI generation - simple CFML pages and custom tags tend to be easier to work with for UI generation. -- Sean A Corfield -- http://www.corfield.org/ Team Fusebox -- http://www.fusebox.org/ Breeze Me! -- http://www.corfield.org/breezeme Got Gmail? -- I have 49, yes 49, invites to give away! "If you're not annoying somebody, you're not really alive." -- Margaret Atwood ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197395 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