• 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: Retain/Release and Properties clarification
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Retain/Release and Properties clarification


  • Subject: Re: Retain/Release and Properties clarification
  • From: Andreas Mayer <email@hidden>
  • Date: Mon, 03 Oct 2011 20:01:51 +0200

Am 03.10.2011 um 16:14 schrieb John Tsombakos:

> audioPlayer = [self getSoundFile:"soundfile.wav"];
> ...
>
> in getSoundFile routine:
> AVAudioPlayer *snd;
> ...
> snd = [[[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error]

The question was already answered, but I wanted to point out that the method (not 'routine') name is misleading.

a) In Cocoa the get prefix is used when values are returned indirectly by pointer.
   Ex. - (void)getRed:(CGFloat *)red green:(CGFloat *)green blue:(CGFloat *)blue alpha:(CGFloat *)alpha
b) You don't return a sound file, you return an audio player.

So I would recommend to name the method something like -audioPlayerWithFile: or -audioPlayerNamed:

Naming conventions are important in Cocoa. Following them makes your code much more readable.


Andreas_______________________________________________

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: Retain/Release and Properties clarification
      • From: John Tsombakos <email@hidden>
References: 
 >Retain/Release and Properties clarification (From: John Tsombakos <email@hidden>)

  • Prev by Date: Re: spin_lock$VARIANT$mp in Sketch
  • Next by Date: Re: Retain/Release and Properties clarification
  • Previous by thread: Re: Retain/Release and Properties clarification
  • Next by thread: Re: Retain/Release and Properties clarification
  • Index(es):
    • Date
    • Thread