In the compiler, underscores are treated like any alphabetic character. In general, underscores are commonly used by language extensions or large libraries to avoid conflicts with user code.
Using underscores is problematic because many groups try to reserve each name with a specific combination of underscores.
Apple has traditionally used a single underscore prefix to denote a private instance variable (common style in object-oriented languages). This was done to suggest that everyone should prefix their ivars with underscores until Apple indicated that using the underscore in your code could lead to conflicts with Cocoa if Apple decides to change its headers, and maybe you shouldn't. Thus, underscore prefixes have become the "not recommended" coding practice.
In C and C derivative languages, any double underlined word before and next is a non-standard language extension. See Apple Extensions such as __attribute __
Trailing underscores are often added as the name of the compiler or debugger for modified versions of the original names (especially when the compiler is multi-pass), and they are usually avoided to remain distinctly different from the originals. Google suffix their Objective-C local instance variables with underscores to avoid conflicts with Apple underscores.
My advice: do not use underscores. You should not use local variables with the same name as instance variables (which is just confusing). The only potential conflict between the parameters in the setter methods and the corresponding instance variables is that you probably need a prefix parameter with the lower case "a", "new" (or similar), as this clearly indicates that the parameter is input values ββbut not yet " value".
Matt gallagher
source share