Possible Duplicate:
With ARC why use @properties anymore?
NB: I actually don't think we can do away with properties, but I'm trying to understand the reasoning as to why not. :)
Referring back to this question, it seems like the principal reason we use properties is to avoid memory management issues. In other words, by creating a property we rid ourselves of the need to write out all these retain and release methods:
- (void) setOtherObj:(MyOtherObject *)anOtherObject {
if (otherObject == anOtherObject) {
return;
}
MyOtherObject *oldOtherObject = otherObject; // keep a reference to the old value for a second
otherObject = [anOtherObject retain]; // put the new value in
[oldOtherObject release]; // let go of the old object
}
Since ARC deals with this now, could we not do away with properties all together and just set ivars by doing something like otherObject = anotherObject
?