title: Defining instance variables in Objective-C
body: <p>As Objective-C has evolved (I use it exclusively with xcode/ios for iPhone/iPad development), there seems to be many different ways you can layout your class instance variables.  Is there a 'best practice' way that's become common consensus? (I realise Apple demo/example code is all over the place in terms of style)</p>
  
  <p>In particular the idea of handling private variables.  Here are a number of ways I've seen to manage some instance variables for a class (I've left out the interface/implementation for brevity) - and I'm not even including the use of underscore named synthesized properties.</p>
  
  <p>.h</p>
  
  <pre><code>@property (nonatomic, strong) NSString *aString;
  </code></pre>
  
  <p>.m</p>
  
  <pre><code>@synthesize aString;
  
  - (void)aMethod {
     aString = @"Access directly, but if I don't have custom getter/setters and am using ARC, do I care?";
     self.aString = @"Access through self";
  }
  </code></pre>
  
  <p>Or this:</p>
  
  <p>.h</p>
  
  <pre><code>@property (readonly) NSString *aString;
  </code></pre>
  
  <p>.m</p>
  
  <pre><code>@property (nonatomic, strong) NSString *aString;
  ...
  @synthesize aString;
  </code></pre>
  
  <p>Or this:</p>
  
  <p>.m</p>
  
  <pre><code>@interface aClass {
   NSString *aPrivateString;
  }
  
  - (void)aMethod {
    aPrivateString = @"Now I have to access directly, but is this atomic/nonatomic?";
  }
  </code></pre>
  
  <p>I don't want this question to turn into a style argument, but it seems to me there should be a "if you're not doing something specific or complex or weird, use this method for defining your class variables" standard.</p>