• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Newbie question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Newbie question
      • From: Johannes Huning <email@hidden>
References: 
 >Newbie question (From: "john darnell" <email@hidden>)
 >Re: Newbie question (From: Michael Vannorsdel <email@hidden>)
 >Re: Newbie question (From: "Hamish Allan" <email@hidden>)

  • Prev by Date: Re: Newbie question
  • Next by Date: Re: ImageIO key properties
  • Previous by thread: Re: Newbie question
  • Next by thread: Re: Newbie question
  • Index(es):
    • Date
    • Thread