Re: Yet another memory management question
Re: Yet another memory management question
- Subject: Re: Yet another memory management question
- From: Michael Ash <email@hidden>
- Date: Sun, 5 Jul 2009 11:23:18 -0400
On Sun, Jul 5, 2009 at 12:10 AM, mmalc Crawford<email@hidden> wrote:
>> Both are fine, but I would suggest something like the following, just
>> because it avoids code duplication:
>> - (void)viewDidUnload
>> {
>> [self dispose];
>> }
>>
>
> It is not clear here what is the benefit of "avoiding code duplication" --
> you're simply introducing another method that you have to keep track of.
It's the same benefit as anywhere else. You have two places,
viewDidUnload and dealloc, which perform the exact same action. Rather
than have identical code in both places, where it bloats up your code
and can fall out of sync, you put that code into a separate method,
then call it from the two places where it needs to happen. This is
pretty basic programming.
Mike
_______________________________________________
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