Re: why does selecting a parent not make me it's child?
Re: why does selecting a parent not make me it's child?
- Subject: Re: why does selecting a parent not make me it's child?
- From: Denis Stanton <email@hidden>
- Date: Thu, 17 Jul 2003 09:44:21 +1200
On Wednesday, July 16, 2003, at 09:15 AM, Chuck Hill wrote:
public Parent currentParent() {
return parent();
}
public void setCurrentParent(Parent value) {
addObjectToBothSidesOfRelationshipWithKey(value, "parent");
}
Then use currentParent for the bindings in place of parent.
public void setParent(Parent value) {
Parent oldParent = this.parent();
oldParent.removeFromHires(this);
value.addToHires(this);
takeStoredValueForKey(value, "parent");
}
I would not do this, this is what
addObjectToBothSidesOfRelationshipWithKey does, but not as flexibly.
What I really meant was the currentParent/setCurrentParent pair above.
Thank you for the explanation, which lead to a couple of those "aha..."
moments when Learning finally occurs.
First I eventually understood that writing new methods for
currentParent is safer than tinkering with the existing setParent
method ( I was already getting problems with my modified class when I
assigned a 'new' parent to a previously parent-less child instance
The second realisation came after I worried that I didn't know how to
bind the popUp selection to the new setCurrentParent method. I was
thinking that the binding was to the parent "variable" and I couldn't
change it. It finally came to me that the binding merely identifies a
pair of methods (currentparent and setCurrentMethod in this case).
Whether they front for a variable, or for another method is not
important. This is so basic to object oriented programming that you
may be wondering what I am talking about, but I have more than 20 years
of programming in my head from before OOD and I still think in terms of
data items that occupy distinct physical bit and bytes in "memory".
Thank you for your patient assistance.
Denis
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.