Re: Category vs Subclass
Re: Category vs Subclass
- Subject: Re: Category vs Subclass
- From: tyler <email@hidden>
- Date: Thu, 16 Aug 2001 10:25:44 -0700
On Thursday, August 16, 2001, at 09:48 AM, Ondra Cada wrote:
Christian,
Christian Mike (CM) wrote at Thu, 16 Aug 2001 11:11:40 -0500:
CM> So this leads to my question:
CM>
CM> When is it appropriate to use a Category versus a subclass?
Very, very often. Actually, whenever
(i) you don't add any property;
(ii) you don't need to call any [super something];
In fact, save the NSObject, NSView, and NSDocument, you *HARDLY EVER*
subclass anything in Cocoa.
Is this really true? Hmm. Guess I've been sub-classing too often (C++
background).
But wouldn't you add at least NSWindowController to that list?
And what about those cases where you want a control to draw differently,
wouldn't that lead you to subclass NSCell or one of it's subclasses?
peace,
tyler