Hi
You are on the right track by avoiding getSponsorN() methods... that's
definitely not the way to go.

There is more than one way to do the getter/setter stuff, and a lot
depends on how you actually need to do it.
* You could go with a getNumSponsors() and getSponsor(n) pair of methods
for "getting".  
* You might add a "contains" kind of method (is this sponsor contained
in the list of current sponsors) if you are doing lots of lookups for a
specific Sponsor; that helps keep the client code simple, but obviously
would only make sense if you do that kind of thing.

Setting is trickier, and it depends on your use-cases.  
* You could probably use a "addSponsor(s)" method that appends to the
list of sponsors
* "setSponsor(n, s)" requires the client to know which sponsor they are
setting (or how many sponsors there already are), but I don't know if
you ever need to do that.

Thanks
        Mark

-----Original Message-----
From: Everett, Al (NIH/NIGMS) [C] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 21, 2006 11:34 AM
To: CF-Talk
Subject: Using arrays in a simple bean

I'm using a bean cfc for an instance of a meeting. Each meeting can have
between 0 and 10 sponsors. (These are just string values.)
 
Rather than have setSponsor1, getSponsor1, setSponsor2 etc. and have 10
different properties in the instance, I thought I'd put it into an
array. This has two other side effects: Memory isn't taken up by
undefined variables and it should easily allow for future
expansion/contraction if the business rules should change.
 
I'm having a bit of trouble getting my head around the best way to do
the getter/setter methods. Has anyone done something similar that I
could crib for ideas?




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:264755
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to