Professional Documents
Culture Documents
TABLE OF CONTENTS
Page 2
Instance variables
There are a few considerations to keep in mind when adding instance variables to a class: y y y y Avoid creating public instance variables. Developers should concern themselves with an object s interface, not with the details of how it stores its data. Explicitly declare instance variables either @private or @protected. If you expect that your class will be subclassed, and that these subclasses will require direct access to the data, use the @protected directive. Make sure the name of the instance variable concisely describes the attribute stored. If an instance variable is to be an accessible attribute of objects of the class, make sure you write accessor methods for it. If not, add _ at the beginning as the prefix.
Page 3
References
y Coding guidelines for Cocoa - Apple
Page 4
Revision
Date 16/1/2011 Changes Instance variable naming rules
Page 5