Re: Subclassing best practice
Re: Subclassing best practice
- Subject: Re: Subclassing best practice
- From: "A.M." <email@hidden>
- Date: Wed, 14 Nov 2007 13:35:04 -0500
On Nov 14, 2007, at 12:39 PM, John Stiles wrote:
I have some code which subclasses NSWindow to tack on some data of
my own:
<snip>
I've run up against this problem with views as well, and I've
managed to get some mileage out of categories, but there are a lot
of situations where you just need to add members.
So what is the best design pattern for something like this?
Anything nicer than a good old fashioned #define?
There is another trick with categories which access a static (global)
dictionary with keys which are the objects to be extended and values
with the additional storage. Nu does this, I believe to make Obj-C
objects more dynamic.
It's easy to implement and make a transparent API, but the downside
is slower (less thread-friendly) access and a clunky, sinking feeling.
Cheers,
M
_______________________________________________
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