November 2013
Beginner
325 pages
9h 47m
English
Given that you can define a constant using #define or a global variable (which includes the use of enum), why do Objective-C programmers tend to use global variables? In some cases, there are performance advantages to using global variables. For example, you can use == instead of isEqual: to compare strings if you consistently use the global variable (a pointer comparison is faster than a message send and scanning two strings character-by-character). Also, global variables are easier to work with when you are in the debugger.
In general, you should use global variables and enum for constants, not #define.
Read now
Unlock full access