Another thing to consider is if any external objects use those
orderItems.  If so, it's probably better to use a formal orderItem
object which will have an enforced interface.

Otherwise, if orderItems are only seen by the object that contains
them, a struct is probably good enough.

On 5/25/05, Ben Rogers <[EMAIL PROTECTED]> wrote:
> If you use an array of objects, then each OrderItem can calculate it's own
> total (quantity * unitPrice = price), calculate it's own weight and return
> references to other objects (orderItem.getItem() would return the actual
> item in the store/catalog). Then, when you need to calculate your order
> total, you can loop through the OrderItems and sum up the total.
> 
> Ben Rogers
> http://www.c4.net
> v.508.240.0051
> f.508.240.0057
> ________________________________________
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of Joe Ferraro
> Sent: Wednesday, May 25, 2005 11:25 AM
> To: [email protected]
> Subject: [CFCDev] object composition - which method is better in coldfusion?
> 
> I have an order object, in ColdFusion which method is better for composition
> of this object.
> 
> Attribute orderItems - array of structures
> 
> Or
> 
> Attribute orderItems - array of orderItem objects
> 
> The average number of order items is 3 and with an occasional high of 20.
> 
> What are your thoughts?
> 
> 
> 
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email to 
> [email protected] with the words 'unsubscribe cfcdev' as the subject of the 
> email.
> 
> CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
> (www.cfxhosting.com).
> 
> CFCDev is supported by New Atlanta, makers of BlueDragon
> http://www.newatlanta.com/products/bluedragon/index.cfm
> 
> An archive of the CFCDev list is available at 
> www.mail-archive.com/[email protected]
> 
> 
>


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

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


Reply via email to