On Sun, Jul 5, 2009 at 12:10 AM, mmalc Crawford<mmalc_li...@me.com> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to