>I can hazard good guesses, but what do you mean by "view, controller and > model" layers?
Ooops... sorry. It refers to the MVC pattern : Model View Controller. - View : the presentation layer (there is usually a HTML-based view layer generated by CFML pages), - Controller : the application flow control, it receives request from the View layer, executes application logic, calls the model layer and returns the response to the View layer, (in web app, it usually handles data posted by forms and then redirect to a page) - Model : the application business logic and data access layer (done with CFCs in ColdfusionMX). As for cfczone.org Vs udflib.org, it is true that they are going to overlapp in some area. All the 'udflib' functions might be encapsulated into CFCs and put on 'cfczone'... And this is probably what is going to happen. In our case, all our CFCs are linked to our application (and therefore to our "business logic") and could not be put or could not come from 'cfczone'. All our UDFs are not linked to our application and are coming from 'udflib'. But, in some cases CFCs might be more appropriate than UDF to encapsulate generic logic : when you need to have an object-oriented logic. Indeed, the advantage of CFCs over UDFs is their ability to have (or simulate) an 'object-oriented/object-based' behaviour. For example, CFC are great to be used as "wrapper" of existing java classes (it keeps the object behaviour of the java class and hide its complexity). With CFC, you can manipulate objects that are "persistent" during the request : - create an object, - call object.method1(), - call object.method2()... The object keep his state/properties in between each calls. With UDF, you can't really have this kind of approach. So, for generic logic encapsulation, I would use : - UDF / udflib.org for procedural logic (functions), - CFC / cfczone.org for object-oriented logic. But, again, this is in my opinion, so I prefer to stop here otherwise it is going to be another never-ending thread... ;) This is really a matter of personal preference/coding style. Benoit Hediard www.benorama.com -----Message d'origine----- De : Gyrus [mailto:[EMAIL PROTECTED]] Envoyé : lundi 30 septembre 2002 14:03 À : CF-Talk Objet : Re: UDF Vs CFC (was RE: So many problems with CFC scopes...) Benoit, thanks for the summary of your rules-of-thumb for CF modularisation. I'll check out your site later. For now, could you clear up some terminology for this no-CS-background designer-turned-coder? ;-) I can hazard good guesses, but what do you mean by "view, controller and model" layers? Also, I know the idea of "business rules" from relational DB design - am I right in saying you're using "business logic" here in a similar sense, to apply to the CF application? That is, it refers to procedures and functions mostly specific to the current application? If this is so, am I right in saying that, given your personal rules, cflib.org for sharing UDFs is useful, but cfczone.org for sharing CFC's is less useful? I know it's fine to use CFC's for generic functions and cfczone.org will probably become as useful as cflib.org, I'm just trying to gauge the meaning of your rules with this analogy. If you use CFCs for "business logic encapsulation", they may not be very portable - unless I'm taking the term "business logic" in a too narrow sense. - Gyrus ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - [EMAIL PROTECTED] work: http://www.tengai.co.uk play: http://www.norlonto.net - PGP key available ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ----- Original Message ----- From: "Benoit Hediard" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Monday, September 30, 2002 9:26 AM Subject: UDF Vs CFC (was RE: So many problems with CFC scopes...) > I agree with you Raymond. > But it is true that is more "personal preference/coding style terms" than > "performance/architecture terms". > > This are my personal rules : > CUSTOM TAGS (ColdFusion Taglibs) > - custom tags encapsulates presentation logic they always output content > (usually HTML), > - custom tags usually do not call the model or controller layer, > - custom tags are only used by the presentation layer (page or pagelet > scripts). > >> They are used for presentation logic encapsulation. > > USER DEFINED FUNCTIONS (UDF) > - user defined functions encapsulate generic logic and rarely output content > (except for string formatting purposes), > - user defined functions do not call the model or controller layer, > - user defined functions are used in any layer (view, controller or model). > >> They are used generic logic/function encapsulation. > > COLDFUSION COMPONENTS (CFC) > - components encapsulate business/data access application logic and never > output content, > - components are called by the view layer only to read data, > - components are called by the controller layer to create/update/delete > data. > >> They are used for business logic encapsulation. > > .. I've put some examples here > http://www.benorama.com/coldfusion/patterns/part3.htm > > Benoit Hediard > www.benorama.com ______________________________________________________________________ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists