Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Using properties and synthesized setters (or correctly hand coded setters) takes a lot of work out of reference counting. As long as you make sure that you always use an instance variable’s setter method to set its value, most of your reference counting takes place automatically.
Note
It is good practice to use the accessor methods, even when accessing an instance variable from within a method. An exception to this rule is when you initialize an instance variable in an init method or release it in a dealloc method. These are purely internal operations. In typical cases of initialization or deallocation, you don’t want or need the side effects that may be caused by invoking accessor methods. In an init method, you should set the instance variable directly (retaining the object you are storing if that is required). In a dealloc method, you should release the instance variable directly instead of invoking the instance variable’s setter with a nil argument.