http://qs1969.pair.com?node_id=309352


in reply to Re: Refreshing Objects
in thread OT: Refreshing Objects

From a OO design point of view, it is not "ideal" to drop the list and create a new list. Your OO code similates the real world. In the real world, when new articles added to a news group, some of the attributes of the news group changed, but the news group is still the same entity as it was. In your OO design, why should you drop and create new objects? all what you want is to update some arributes.
I think maybe I didn't explain myself very well. I'm not talking about dropping the list of articles. I'm talking about dropping the list of newsgroups. The list of groups is somewhat harder since groups can be removed.

At the root of my hierarchy is a list of servers. Each server has a list of different newsgroups that you can subscribe to. This list of groups can change, either because groups or added or because they are removed. Each group the user subscribes to then contains a list of messages in that group.

When I refresh the list of groups from each server, I need to find a way to keep the list of messages in the groups the user has subscribed to.

Also, you tell me not to create a new list of objects, but then you tell me that copying message lists (and other properties) from the old list to the new list is a good solution. Which is it?

I just want to find the best solution for this type of problem. If writing a search method is the best way to do it, I'll write a search method. But if there's a simpler way, why would I want to?