title: Objective-C Exceptions
body: <p>I have just completed an iPhone app programming course. As part of the course, I saw</p>
  
  <ul>
  <li>Objective-C provides exception handling using the <code>@try</code> directive</li>
  <li>The system library does not use exception handling, preferring to <code>return nil</code></li>
  </ul>
  
  <p>I asked if I should use exception handling for new code I wrote (e.g. if I write both the front-end and logic code, so the communication between them is in my hands) but I was told no, one should not use exceptions for new code. (But he failed to elaborate, then the class moved on, I thought perhaps the reason would become clear later..)</p>
  
  <p>Surely exceptions are superior to <code>return nil</code>? You can catch particular types, you are not tempted to ignore them by ignoring the return type of a function which normally succeeds, you have text messages which can be logged, they allow your code to focus on the normal case and thus be more readable. <a href="http://www.databasesandlife.com/exceptions-use-them">Why to use exceptions</a>.</p>
  
  <p>So what do you think? Was my trainer right not to use Objective-C exceptions? If so, why?</p>