On Mon, 7 Nov 2011 16:03:46 -0800, Jens Alfke said:

>> I'm reviewing some sample code and am looking at a class with a method
>declared in @implementation which isn't mentioned in any @interface.
>> 
>> Is this a private method, something else entirely, or merely sloppy
>coding?  
>
>That’s considered a private method. (Unlike in C++ there’s no way to
>absolutely prevent external code from calling it, but the compiler will
>give you warnings if you try to do it directly.)
>
>In Objective-C it’s considered good style to have the @interface section
>show *only* the public API of the class. Internal methods should go only
>in the @implementation. (If you need a forward declaration you can do
>that with a class continuation in the .m file.)
>
>This keeps the header more readable and hides the implementation details
>of the class from view. It also speeds up compilation a bit, and can
>avoid the need to #import more headers from your .h file.

Also new with clang (not sure which version exactly):

you can declare your ivars in your .m instead of in your .h.  This is great 
since it hides more implementation details from those reading your public 
header files.

Cheers,

-- 
____________________________________________________________
Sean McBride, B. Eng                 s...@rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to