Re: Retain/Release and Properties clarification
Re: Retain/Release and Properties clarification
- Subject: Re: Retain/Release and Properties clarification
- From: John Tsombakos <email@hidden>
- Date: Mon, 03 Oct 2011 14:46:53 -0400
On Mon, Oct 3, 2011 at 2:01 PM, Andreas Mayer <email@hidden> wrote:
>
> 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.
Yeah, this was typed in the email, so I just typed something to show
that I had a method that returned the audio player. That's what I get
for being quick :)
Thanks, though..
_______________________________________________
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