title: Where to put iVars in "modern" Objective-C?
body: <p>The book "iOS6 by Tutorials" by Ray Wenderlich has a very nice chapter about writing more "modern" Objective-C code. In one section the books describes how to move iVars from the header of the class into the implementation file.
  Since all iVars should be private this seems to be the right thing to do.</p>
  
  <p>But so far I found 3 ways of doing so. Everyone is doing it differently.</p>
  
  <p>1.) Put iVars under @implementantion inside a block of curly braces (This is how it is done in the book).</p>
  
  <p>2.) Put iVars under @implementantion without block of curly braces</p>
  
  <p>3.) Put iVars inside private Interface above the @implementantion (a class extension)</p>
  
  <p>All these solutions seems to work fine and so far I haven't noticed any difference in the behavior of my application.
  I guess there is no "right" way of doing it but I need to write some tutorials and I want to choose only one way for my code.</p>
  
  <p>Which way should I go?</p>
  
  <p><strong>Edit: I am only talking about iVars here. Not properties. Only additional variables the object needs only for itself and that should not be exposed to the outside.</strong></p>
  
  <p>Code Samples</p>
  
  <p>1)</p>
  
  <pre><code>#import "Person.h"
  
  @implementation Person
  {
      int age;
      NSString *name;
  }
  
  - (id)init
  {
      self = [super init];
      if (self)
      {
          age = 40;
          name = @"Holli";
      }
      return self;
  }
  @end
  </code></pre>
  
  <p>2)</p>
  
  <pre><code>#import "Person.h"
  
  @implementation Person
  
  int age;
  NSString *name;
  
  
  - (id)init
  {
      self = [super init];
      if (self)
      {
          age = 40;
          name = @"Holli";
      }
      return self;
  }
  @end
  </code></pre>
  
  <p>3)</p>
  
  <pre><code>#import "Person.h"
  
  @interface Person()
  {
      int age;
      NSString *name;
  }
  @end
  
  @implementation Person
  
  - (id)init
  {
      self = [super init];
      if (self)
      {
          age = 40;
          name = @"Holli";
      }
      return self;
  }
  @end
  </code></pre>