Question about Style wrt private methods

2009-11-18 Thread Michael de Haan
In the newly released Cocoa design patterns (Buck and Yacktman), the chapter discussing Delegates includes an example, which in it's implementation file, has the following method, which is defined/declared like this: ( I have removed the actual definition) -

Re: Question about Style wrt private methods

2009-11-18 Thread Jens Alfke
On Nov 18, 2009, at 9:44 AM, Michael de Haan wrote: Names of most private methods in the Cocoa frameworks have an underscore prefix (for example, _fooData ) to mark them as private. From this fact follow two recommendations. • Don’t use the underscore character as a prefix for your

Re: Question about Style wrt private methods

2009-11-18 Thread Jim Correia
On Nov 18, 2009, at 1:49 PM, Jens Alfke wrote: This is unfortunately true. The danger is that if you add an _- prefixed method to your class, it might conflict with a private method declared in a superclass. If this happens your method will override the internal one, and Really Bad Things

Re: Question about Style wrt private methods

2009-11-18 Thread Jens Alfke
On Nov 18, 2009, at 11:15 AM, Jim Correia wrote: This problem is just not restricted to private methods, or additions through categories. You can also run afoul of a namespace conflict with a public method in your subclass. Yes; but this is less likely because Apple engineers add public

Re: Question about Style wrt private methods

2009-11-18 Thread Jim Correia
On Nov 18, 2009, at 2:32 PM, Jens Alfke wrote: On Nov 18, 2009, at 11:15 AM, Jim Correia wrote: This problem is just not restricted to private methods, or additions through categories. You can also run afoul of a namespace conflict with a public method in your subclass. Yes; but this

Re: Question about Style wrt private methods

2009-11-18 Thread Michael de Haan
On Nov 18, 2009, at 11:15 AM, Jim Correia wrote: On Nov 18, 2009, at 1:49 PM, Jens Alfke wrote: This is unfortunately true. The danger is that if you add an _-prefixed method to your class, it might conflict with a private method declared in a superclass. If this happens your method will

Re: Question about Style wrt private methods

2009-11-18 Thread Sean McBride
On 11/18/09 2:15 PM, Jim Correia said: This problem is much less insidious than the category problem, but the potential does exist. (For both private and public methods.) For the category case, you can set the environment variable OBJC_PRINT_REPLACED_METHODS=YES. You'll get something like this: