Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Re: Child objects querying parent objects about themselves

by vaevictus (Pilgrim)
on Nov 13, 2002 at 19:09 UTC ( #212665=note: print w/replies, xml ) Need Help??


in reply to Re: Child objects querying parent objects about themselves
in thread Child objects querying parent objects about themselves

Thanks. As far as the \$parent typo, i've already got it correct in my code... just not when i typed it into SOPW. Thanks for the heads up though.

As for the method you described ... this is probably the best way to do it... naturally... if this becomes too much overhead, i'll have to make the coords redundant somewhere, as described in jdporter's comment.

  • Comment on Re: Re: Child objects querying parent objects about themselves

Replies are listed 'Best First'.
Re: Re: Re: Child objects querying parent objects about themselves
by nothingmuch (Priest) on Nov 13, 2002 at 19:54 UTC
    An object oriented principial dilema arises from such redundancy - should the child object be responsible for it's location in the parent (knowing and/or maintaining)?
    Some will argue that since the children heriarchly exist within the parent, then the responsibility should only be the parent's...
    This is perhaps analogeous to the question of wether you should use method objects within sibling methods, or access the object internals directly.
    Think about it.

    In addition, perhaps Tie::RefHash may be of use for maintaing a hash of references to the child objects, within the parent. The parent can simply lookup child by it's object reference, and in the hash will be the coordinate values.

    -nuffin
    zz zZ Z Z #!perl
      This is exactly my question and dilema-> I believe that the child *is* hierarchly placed within the parent and that the responsibility should only be the parent's. And thus, while implementation is not a difficult situation as far as any of the 3 suggestions from jdporter's comments, the usage of redundancy in just the parent or partly in the child seem extra.

      I believe I will brute force the results currently, but probably be forced to provide a lookup hash in the parent for efficiency.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (1)
As of 2022-01-19 02:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (55 votes). Check out past polls.

    Notices?