|go ahead... be a heretic|
Re: Re: Re: Child objects querying parent objects about themselvesby nothingmuch (Priest)
|on Nov 13, 2002 at 19:54 UTC||Need Help??|
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.
zz zZ Z Z #!perl