Re: Coding norms
Re: Coding norms
- Subject: Re: Coding norms
- From: David Remahl <email@hidden>
- Date: Thu, 12 Dec 2002 09:14:40 +0100
On Thursday, December 12, 2002, at 06:48 AM, Alan Nilsson wrote:
I have a couple of questions about coding styles I was hoping to get a
consensus on.
1. Is it customary to declare delegate methods that a delegate class is
going to implement? For example, if you have an AppController class,
although it is not necessary to declare applicationDidFinishLaunching
in the
header, but is it customary to do so?
No, I don't think that is customary. If you think it provides useful
information the the person who reads the header file, or would like to
allow other objects to call the delegate method as any other public
method, then you should include it. But since delegate methods are
listed in the header for the object that calls them (for example
NSApplication.h or NSTableView.h) you don't have to.
2. What do most people (or perhaps what does industry expect) in
regards to
private methods? For example, a method that is only used internally
by a
class can be simply defined at the top of the implementation file and
not
even declared in the header. What is the norm? Is there one?
Personal
preference?
Private methods should not be exposed in public header files, unless
you think you can support them in the future. In order to keep the
object implementation separarte from the interface it is best to
declare implementation details in the implementation file, so that it
is easier to make changes to the internal workings of the object.
/ Regards, David Remahl
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >Coding norms (From: Alan Nilsson <email@hidden>) |