Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: Refreshing Objects

by elusion (Curate)
on Nov 23, 2003 at 21:19 UTC ( #309352=note: print w/ replies, xml ) Need Help??


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?


Comment on Re: Re: Refreshing Objects
Re: Re: Re: Refreshing Objects
by pg (Canon) on Nov 23, 2003 at 21:41 UTC
    "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.

    This is not a problem. As I mentioned in my previous reply, there is no need for you to physically delete the object, instead

    • You can either mark it as inactive,
    • or move it to another collection, which contains all news groups that the user once subscribed, but no longer exists.

    Either way, you would still be able to preserve the messages in that group.

    "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?"

    Hm... That does not sound like what I suggested. But it could well be my fault, as I probably didn't explain myself well, or I probably didn't understand your entire situation well.

    But is it not true, that the list of articles under an object can be re-hooked to a different object, without copying the entire list? If it is not, you have to look at this again.

    Also, is it not true that, in a tree structure, when you reposition a node, you could choose to keep the entire subtree under it untouched (follows it to where it goes)? If that sounds like something you need, you may want to think about it.

    Well, I may still not understand your entire situation well, but take my suggestions, if they fit in your situation, otherwise discard them or save them for next time. If we can discuss this face to face, it would surely be much easier for us to understand each other better, well...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://309352]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2014-12-17 22:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (40 votes), past polls