As the person pushing this in the CF-Talk thread, I have to disagree with
Dan on this one. Though I think he may be misunderstanding the question.
Dan, to be clear, the issue isn't whether it is OK for a Controller CFC to
use values *passed-in* via a method call or constructor, which I agree is
fine and is in fact the way it should almost always be done. He's asking
whether it is literally OK to directly reference "application.dsn" or
something from within a Controller, which I would say no to.

I don't see any reason why a Controller CFC should need to access anything
in the application or session scopes, or anything external to the component
for that matter (meaning anything not passed as arguments to the method or
properties of the component).

In fact, I'd argue that in most cases, if you think you need to access an
application or session variable from inside a Controller, it means you may
want to reconsider what the Controller is doing in the first place. Things
like "application.dsn" or "session.userID" should probably never be needed
by a Controller. These things are used by the Model, and the apparent need
for these kinds of values may indicate that your Controller is doing work
that should really be happening in the Model anyway. My Controllers are
really, really dumb. All they do make requests to the Model to perform
processing, and render Views.

regards,

Brian



On Tue, Apr 29, 2008 at 12:03 PM, Charlie Griefer <[EMAIL PROTECTED]>
wrote:

>
> Hey all...
>
> I've had a lingering question, and a thread over on cf-talk (about
> properly encapsulating CFC methods) has really got me thinking about
> it.
>
> Over on that thread, there's a "debate" (to use the term loosely) on
> accessing the application scope from within a CFC.  Yes, I understand
> that's a "bad thing" and I understand why.  But in an MVC framework...
> what about CFCs in your controllers?  Those CFCs don't really model
> any particular object.  They're more of a transport mechanism to
> facilitate communication between the model and the view.
>
> So, I get that CFCs in the model should be encapsulated.  But what
> about CFCs in the controller?  is it "acceptable" (which i realize is
> a subjective term) to access shared scopes like application and
> session from controller CFCs?
>
> --
> Evelyn the dog, having undergone further modification pondered the
> significance of short-person behaviour in pedal depressed,
> pan-chromatic resonance, and other highly ambient domains. "Arf," she
> said.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to cfcdev@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to