>- see footer for list info -<
Not really relevant, but...
... I'd use an array instead of a structure if that's all the code does. An
array feels more structured when you have many things.
A reason to stick with the structure is if you want to return more data,
i.e. error codes, error messages. Then you can have...
<cfoutput>
#result.errorCode#: #result.errorMessage#
</cfoutput>
... sort-a-thing.
If it's many things, in this case it's many queries, then I'd go for an
array.
What-do-ya-reckon?
Ade
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Gary F
Sent: 29 December 2005 16:07
To: Coldfusion Development
Subject: Re: [CF-Dev] The THIS scope in CFCs
>- 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.
_______________________________________________
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 -<