Matt,
I'm not going to claim to be an OO guru.  If you haven't yet, I  
highly suggest picking up the Fall issue of the Fusion Authority  
Quarterly Update, which is basically all OOP stuff.  I had so many ah- 
ha's going through that cover to cover that I literally felt  
embarrassed at times about some of my own  misconceptions.   If  
you've studied the ModelGlue framework, Joe Rinehart's introduction  
to ModelGlue article is awesome.  I've been using MG:U for only 6  
months or so know and I never realized just how much I could do with  
it (that I wasn't doing) until I read that article.

See my own replies to your questions inline:

On Dec 30, 2006, at 3:12 PM, Matt Quackenbush wrote:

> Question # 1: Am I correctly understanding what a 'controller' is?   
> As I
> understand it, in an MVC environment, the controller is what  
> handles all the
> various tasks required prior to rendering the requested page.  In  
> the past,
> I would simply write this code at the top of the file that was  
> requested.

Yes and no.  The Controller layer acts as a the filter for the  
parameters which the Model may act upon.   That being said, you may  
have multiple controllers, depending on the scope and purpose of your  
application.   One of the apps that I'm working on at the moment is a  
Model Glue app that has only one controller, User, as basically the  
entire app revolves around content generated being specific to that  
user.   Most of the Model is dependent on that CFC.  This is a  
beautiful thing as it allows me to easily control the level of access  
to the content and business logic executed for every request  - from  
that one place.

> Question # 2: Assuming that the answer to Q1 is 'Yes', is it
> correct/okay/accepted for the controller to be a CFC as opposed to an
> include or custom tag, and that controller CFC to reference outside  
> scopes,
> such as 'form', 'url', 'session', and 'cgi'?

I think so.  That's the power of funneling your requests through the  
Controller layer.   Using an init() method, for example, we might set  
and scope some or all of those variables for use in the Model  
layer.   I know that Model Glue, for example, is designed to handle  
those scopes within the Controller.  To Quote Joe Rinehart's article  
from FAQU: "Controllers receive data from the URL and Form scopes,  
ask for actions to be performed on the data, and return a result to  
the View."

>  My problem is
> that I live by the rule that my CFC objects are not permitted to  
> access
> anything outside of themselves, so trying to reason with myself  
> here is
> causing quite a headache.  On one hand I tell myself, "the  
> controller isn't
> an object per se, so it's okay."  On the other hand, I say, "it's a  
> damn
> CFC!  Don't reference anything outside of it!"

I think you  limit yourself with that rule.  I believe it's  
acceptable to use those variables in your controller to direct what  
is executed in the Model Layer.  In Model Glue, for example, your URL  
variables automatically become part of the "viewstate" values and are  
available for use by the controllers in your ModelGlue.xml file in  
subsequent broadcasts.

Hope I've helped a bit.  I'm certainly not the last word in OOP, but  
I try to make up in enthusiasm for what I may lack in understanding :-)

Best regards,

Jon


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265401
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to