Do you speak outside the classroom or inside? If not, then you always use an accessor. First of all, the default visibility for ivars in ObjC is @protected , so unless you explicitly make them @public , you need to use an accessor. In addition, you use an accessor because you never know if you (or anyone else) can subclass your class and change it so much that you need to use an accessor.
If you speak in the class, you do not need to use an accessory, but if you set the values ββof @property , there is no reason not to use dot notation, even if you synthesize everything. If you use standard ObjC notation, for example [myObject someVariable] , then repeated nested messages may be hard to read and cluttered.
Indeed, an accessor is not as large as a mutator, because mutators often do more than one. Using both getters (outside the class) and setters is good practice.
source share