title: Best way to define private methods for a class in Objective-C
body: <p>I just started programming Objective-C and, having a background in Java, wonder how people writing Objective-C programs deal with private methods.</p>
  
  <p>I understand there may be several conventions and habits and think about this question as an aggregator of the best techniques people use dealing with private methods in Objective-C. </p>
  
  <p>Please include an argument for your approach when posting it. Why is it good? Which drawbacks does it have (that you know of) and how you deal with them?</p>
  
  <hr/>
  
  <p>As for my findings so far.</p>
  
  <p>It is possible to use <a href="http://www.otierney.net/objective-c.html#categories" rel="noreferrer">categories</a> [e.g. MyClass (Private)] defined in MyClass.m file to group private methods.</p>
  
  <p>This approach has 2 issues:</p>
  
  <ol>
  <li>Xcode (and compiler?) does not check if you define all methods in private category in corresponding @implementation block</li>
  <li>You have to put @interface declaring your private category in the begin of MyClass.m file, otherwise Xcode complains with a message like "self may not respond to message "privateFoo".</li>
  </ol>
  
  <p>The first issue can be worked around with <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_4_section_5.html#//apple_ref/doc/uid/TP30001163-CH20-SW2" rel="noreferrer">empty category</a> [e.g. MyClass ()].<br/>
  The second one bothers me a lot. I'd like to see private methods implemented (and defined) near the end of the file; I do not know if that's possible.</p>