objc-zen/objc-zen-book

Private method with _ prefix.

jaybowang opened this issue · 3 comments

Never prefix your private method with a single underscore _

- (void)_notifyDelegates {

The two lines above are just copied here.

And the reason would be?

@MKGitHub The method _notifyDelegates is prefixed with a single underscore, which is wrong as Never prefix your private method with a single underscore _ says.

Found Typographic Conventions by accident in Apple's Code Naming Basics document.

Avoid the use of the underscore character as a prefix meaning private in method names (using an underscore character as a prefix for an instance variable name is allowed). Apple reserves the use of this convention. Use by third parties could result in name-space collisions; they might unwittingly override an existing private method with one of their own, with disastrous consequences. See Private Methods for suggestions on conventions to follow for private API.

And the problem is that the method _notifyDelegates is prefixed with _ which is a bad method naming example. _ should be deleted.