Great idea! I typically only generate a handful of widgets for any given application (most people want most of their tables, forms and views to have a consistent look), so caching them into an application scoped singleton wouldn't take too much memory but should improve performance.
As a side note, how are people finding performance of best practice designed OO systems in MX7? In general, if you take a well designed CF5 app and turn it into a well designed MX7 app are you seeing at least comparable performance? -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nando Sent: Thursday, January 19, 2006 3:28 AM To: [email protected] Subject: RE: [CFCDev] Creating User Controls - cfc or tag? Others may argue against the practice, but i've used CFC's to generate HTML blocks for a long time, and i'm pretty happy with it. Of course, these CFCs are highly cohesive - that's all they do. As a side note, i'm using the cfsavecontent tag and returning the variable generated by the tag and leaving output="false" set on the function. That allows me to tightly control whitespace output, and even run a regex to strip any whitespace as appropriate to the content block on the cfsavecontent variable. The advantage i ran across is that i can cache them in application scope (within a singleton that manages the display of pages) along with all the gateways needed to pull data in from the DB, and that seems to make it quite performant, especially on pages with lots of content blocks. >-----Original Message----- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >Behalf Of Peter Bell >Sent: Thursday, January 19, 2006 6:38 AM >To: [email protected] >Subject: [CFCDev] Creating User Controls - cfc or tag? > > >Hello All, > >My introduction to OOP in CF is a rewrite of a CF5 application >generator in CFMX 7. I have a pretty good domain object model but am >having trouble finding best practices for the UI. > >All of the controller (index.cfm) and model (various cfc's with a >simple façade abstracting the business objects) runs first and then the >model uses rules to determine what screen template to include. For >instance, if form validated, display a list and a "added OK" message, >if it failed, re-display the form screen. It then calls the appropriate >screen. > >The screen is currently looking like being a simple CFML template that >knowledgeable graphic designers can edit and that is comprised of >static HTML, support for variables and basic logic using a generic >syntax (so I can generate in other languages), and a number of widgets. > >The widgets are produced by a code generator that generates (and can >save to files at design time) common UI widgets (table with pagination, >simple form, >n-record update table, etc.) from a set of primitives. The generated UI >widgets can then be passed certain runtime properties (object type to >display, display properties for this instance, etc.) and generate the >appropriate HTML which is then pulled together by the page and screen >templates. > >I'm tempted to describe the widgets something like: <Element >name="PagedTable" Property1="value1" . . . /> for the designers. I can >then use a Regex/parser to turn that into any appropriate >format/include/call. > >How would you recommend calling the user interface widgets? > >I'm tempted to put them into methods of a UI CFC which returns the HTML >string to display. That would also make it fairly easy to refactor to a >Factory pattern to support n-output methods (optimized for different >devices, etc.) but no less than Ben Forta suggests using custom tags >for UI. > >Are there some considerations I'm missing? > >Be gentle on me. This is my first OOP projects and I've been thinking >about this less than a week!!! > >Best Wishes, >Peter > > > > >---------------------------------------------------------- >You are subscribed to cfcdev. To unsubscribe, send an email to >[email protected] with the words 'unsubscribe cfcdev' as the subject >of the email. > >CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting >(www.cfxhosting.com). > >An archive of the CFCDev list is available at >www.mail-archive.com/[email protected] > > ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
