Thanks for the insights. Very helpful.

-Rich

-----Original Message-----
From: Sean A Corfield [mailto:[EMAIL PROTECTED] 
Sent: Saturday, August 09, 2003 11:09 PM
To: CF-Talk
Subject: Re: Objects Everywhere!

On Saturday, Aug 9, 2003, at 17:45 US/Pacific, Rich Z wrote:
> Umm, not sure really. Lemme throw out an extreme example. Let's say a
> "user" (to further the illustration below) has 230 "bookmarks." Let's
> also assume that there are all sorts of properties associated with a
> bookmark (e.g. description, date added, title, url, etc.) but all I 
> need
> to display are the url's on the user page. It just seems that to use a
> getter for each of the 230 bookmarks for 1 or 2 fields is overkill.

Right, so the issue here is all about which 'objects' in your model are 
really important objects that actually have behaviors and which are 
just data.

While a bookmark object may be very reasonable if you are focusing on 
the bookmarks themselves, that implementation may be overkill if you're 
really focused on the user.

> An alternative I suppose is to just have a person.bookmarks property
> that carries an array (or query) with the information that is
populated
> from the bookmark object?

Yes, or have a bookmarks object that holds all the bookmarks in some 
internal format (such as a query, for example) with some methods to 
make it easier to retrieve data from that internal format.

Again, it's the decision about whether an individual bookmark is 
important enough to model on its own or whether you really just want to 
model the collection of bookmarks.

> I guess all I'm asking is - as far as OO approaches is concerned - how
> should one handle a scenario where an object's composition includes 
> many
> instances of the same object?

There's no hard and fast rule. If the collection itself is important, 
model that as an object. If the contents of the collection are the most 
important part, an array of objects is reasonable.

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to