- see footer for list info -<
Yes absolutely :). However, I think you can get rid of the two lines:

<CFSET query1=result.query1>
<CFSET query2=result.query2>

All you are doing there is renaming variables that you already have and making 
needless copies of data. You can use them like:

<cfoutput query="result.query1">
</cfoutput>

Dom



Gary F wrote:

- see footer for list info -<
Thanks everyone for your replies - clearly a lot of opinions and I like them
all. So what do I do? Since my app is for the biggest project I've ever
worked on in my life I can appreciate the benefits of using this
encapsulated OOP approach. But I also love Russ's approach (or attitude!)
:-)

Returning a structure hasn't been as bad as I first thought. It's only 2
extra lines of code and if it keeps things tidy, allows encapsulation/OOP,
and will mean future programmers won't need to open up CFCs then I'll go for
it. Can I just check my code is saintly enough - I think this is what
Dominic was explaining. This CFC gets 2 queries in one go.

In the CFC:
<CFSET result=StructNew()>
<CFSTOREDPROC blah blah (SP returns 2 queries in 1 go)>
<CFPROCRESULT name="result.query1" resultset="1">
<CFPROCRESULT name="result.query2" resultset="2">
<CFRETURN result>

In the parent page:
<CFSET obj=CreateObject("component","myCFC")>
<CFSET result=obj.myFunction(args)>
<CFSET query1=result.query1>
<CFSET query2=result.query2>

Ta-daa! I think this combines the simplicity that THIS gives with the
benefits of OOP. Do I pass? ;-)

Cheers all,
Gary.


On 12/29/05, Snake <[EMAIL PROTECTED]> wrote:
- see footer for list info -<
Well you better start farting at my CFC's then :-)
I knew that b4 I did it though, but seieng as my cfc's will never be taken
outsid eof this app, and will thus always use those variables and that
DSN,
I don't care :-)



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Adrian Lynch
Sent: 29 December 2005 15:22
To: Coldfusion Development
Subject: RE: [CF-Dev] The THIS scope in CFCs

- see footer for list info -<
I used to think the same thing, if you're not going to be consistent, why
bother? But sometimes doing things in stages is a nicer way to get in to
it
all.

Some people will fart if they see <cfquery datasource="#REQUEST.DSN#"> in
a
CFC for example!

I say do it in steps, understand why encapsulation is a good thing and
then
start to use it more and more in your code.

Ade

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Snake
Sent: 29 December 2005 14:53
To: 'Coldfusion Development'
Subject: RE: [CF-Dev] The THIS scope in CFCs


- see footer for list info -<
That is of course presuming you currently code in a similar way without
CFC's.
You could equally say that putting data in request scope or using the
caller
scope from custom tags is bad practice for the same reason.
I think if your going to actually care about whether or not using the THIS
scope is bad, the rest of your code needs to follow the same process and
be
encapsulated, otherwise what is the point.

Russ

_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
- Hosting provided by www.cfmxhosting.co.uk -<
- Forum provided by www.fusetalk.com -<
- DHTML Menus provided by www.APYCOM.com -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your help
-<
_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
- Hosting provided by www.cfmxhosting.co.uk -<
- Forum provided by www.fusetalk.com -<
- DHTML Menus provided by www.APYCOM.com -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your help
-<

_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
- Hosting provided by www.cfmxhosting.co.uk -<
- Forum provided by www.fusetalk.com -<
- DHTML Menus provided by www.APYCOM.com -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<


_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
- Hosting provided by www.cfmxhosting.co.uk -<
- Forum provided by www.fusetalk.com -<
- DHTML Menus provided by www.APYCOM.com -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to