Re: Newbie question
Re: Newbie question
- Subject: Re: Newbie question
- From: Douglas Davidson <email@hidden>
- Date: Mon, 7 Apr 2008 10:40:26 -0700
On Apr 7, 2008, at 10:28 AM, Hamish Allan wrote:
On Mon, Apr 7, 2008 at 6:05 PM, Michael Vannorsdel
<email@hidden> wrote:
Change the function declarations/definitions to
- (NSString*)ChooseString:(int) IntVal (the * goes inside the
parenthesis)
Additionally, it's good practice to start method names and variables
with lowercase letters; something like "ChooseString" or "IntVal"
looks like a class name to a seasoned Cocoa programmer.
- (NSString *)chooseString:(int)intVal
An excellent suggestion; and even better would be to give the method a
name that describes what it takes and returns. A name like -
chooseString: does not suggest a method that returns a value; for such
a method we might pick a name like -stringAtIndex: or -
chosenStringAtIndex: instead. This might seem like a trivial point,
and perhaps it is, but a great deal of the consistency and
predictability of the Cocoa interfaces comes from API conventions, of
which naming patterns are no small part. Learn these patterns, and
you will be better able to predict what methods a Cocoa class is
likely to have, and remember what they do, just from their names.
Douglas Davidson
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden