Ok. My question was innocent - I have only been developing with CFCs for 5 months and learning and understanding what people are doing helps.

When I was developing in VB 5 a while ago, the book I learnt the OO side of VB5 from (painful at best) had you creating setters and getters for every publically accessible element of the class. It became so repetitive and boring that I wrote a quick VB-based code generator to do it for me, just adding a list of field names to it as and when required. Typeless languages make that a simple proposition.

I know from experience the less typing I have to do the less mistakes I make :)

I am going to have to investigate these bean things soon, I tend to eat or brew the ones I come in to contact with.

Thanks for your answer.
Aaron

Peter Bell wrote:
How about displaying it on screen? There ARE use cases for
#Product.display('Title')# #Product.display('Price')#,
#Product.display("ThumbnailImage')#, etc. You could compose the cf display
template within the bean, but you'd still be left with
#THIS.display('Title')# all over the template.

Do agree that in the general case you want to provide as few getters and
setters as necessary.

Best Wishes,
Peter



On 3/16/07 3:06 PM, "Aaron DC" <[EMAIL PROTECTED]> wrote:

Can I ask why you are getting discrete elements of a CFC? What do you
intend to do with the information once you have it? I don't mind my
tables having 100 or more fields, btw.

Thanks
Aaron

Phillip Senn wrote:
Here's a typical getter:

<cffunction name="getCustomerName" access="public" output="false"
returntype="string">
<cfreturn variables.strCustomerName />
</cffunction>

My impression is that if a table has 100 fields, then there are going to
be 100 getters.

Q: Is it possible to write a generic getter that uses perhaps an array
index or some other voodoo method instead of hard coding 100 getters?

<cffunction name="getter" access="public" output="false"
returntype="any">
<cfargument name="Index" required="true">
<cfreturn variables.Array[arguments.Index] />
</cffunction>


If the number 100 makes you uncomfortable, substitute the number 50, or
25.   Whatever number you're comfortable with.  I know some people balk
at a table having 100 fields.

You are subscribed to cfcdev. To unsubscribe, please follow the instructions
at http://www.cfczone.org/listserv.cfm

CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com

An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]






You are subscribed to cfcdev. To unsubscribe, please follow the instructions at 
http://www.cfczone.org/listserv.cfm

CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]





You are subscribed to cfcdev. To unsubscribe, please follow the instructions at 
http://www.cfczone.org/listserv.cfm

CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]

Reply via email to