What is the best approach in terms of:
- security and control of leaks?
- performance?
- visibility outer the class?
First: keeping control of each variable
if (objectProperty_ != anObject) {
[objectProperty_ release];
objectProperty_ = [anObject retain];
}
Second: declaring properties and using the accessors and letting the system do the work
@property (nonatomic, readwrite, retain) NSObject *objectProperty;
...
@synthesize objectProperty = objectProperty_;
...
self.objectProperty = anObject;
Thank you.