Re: Category vs Subclass
Re: Category vs Subclass
- Subject: Re: Category vs Subclass
- From: "David P. Henderson" <email@hidden>
- Date: Thu, 16 Aug 2001 23:37:34 -0400
On Thursday, August 16, 2001, at 01:41 , Finlay Dobbie wrote:
>
What about if you need to override a method and provide your own
>
implementation? :-)
>
Then you are probably better off subclassing. If you use categories, you
lose access to super. If you are overriding, chances are you will
need/want access to super's implementation to handle the cases you're
uninterested in changing the behavior. Category methods affect all
objects in your project which touch them ie a class implementation
includes the file containing the category. Whereas, with subclass, only
objects of the subclass or its descendants are affected by the
overridden methods. If I haven't explained this problem correctly,
please correct it for the benefit of all.
Dave
--
Chaos Assembly Werks
"The proper office of a friend is to side with you when you are in the
wrong. Nearly anybody will side with you when you are in the right."
- Mark Twain