Just completed the book - food for thought


#1

Hi BNR.

Thank you for writing an excellent book. I’ve learnt a lot and I know this is just the beginning.

I know I will never stop learning the language and developing for iOS - but there are some awesome websites and people online that I can get help from when I become stuck on a project.

I found the book had some good chapters and some were difficult to grasp but as time goes on it will sink in the more I use those concepts.
Admittily this is my second read of the book - I tried last year however due to family commitments and being in a different line of work I could never finish the book.
I was fortunate enough to be given the opportunity to work for a company as a junior iOS developer and they would invest in my education on iOS development - which is why I am able to finish the book this year and do what I love. Every day. :smiley:

With regards to switch statements: I find them very easy to understand and useful - however how much do we use them in the real world?
Since a switch can only accept a constant integer I guess that means not a lot…?


#2

I love switch statements!!!

They read easier than if elses, and they actually run faster (the program jumps to the single case used, without ‘finding it’.

A switch statement can fall through to the next case if you don’t break, allowing you to have common code acting on many cases.

switch (statement)
{
   case 0:
       doSomething;
   default:
   case 1:
   case 2:
       doNextStep;
       break;
  case 3:
      doSomethingElse;
      break;
   case 4:
      wipeUsersHardDrive;
      break;

try to use enums and not magic numbers so you can see what is going on… Who knows what case 4: is, but WIPE_HARD_DRIVE is more descriptive…

Any chance to use switch stayements, and thats what i use…


#3

Another reason to use a switch instead of a whack of if else’s, is that when using a switch with a set of defined enums, xcode will warn of missing enums from the switch statement…