I have just completed an iPhone app programming course. As part of the course, I saw
@try
directivereturn nil
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..)
Surely exceptions are superior to return nil
? 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. Why to use exceptions.
So what do you think? Was my trainer right not to use Objective-C exceptions? If so, why?