Re: Subclass of NSMutableDictionary hanging
Re: Subclass of NSMutableDictionary hanging
- Subject: Re: Subclass of NSMutableDictionary hanging
- From: Chris Hanson <email@hidden>
- Date: Sun, 4 Mar 2007 01:04:21 -0800
On Mar 2, 2007, at 10:31 PM, Nick Forge wrote:
I am developing a preferencePane that makes use of a subclass of
NSMutableDictionary. My subclass (SPPowerSourceSettings) has only
three methods, which is one custom init method and a pair of "get
and set" methods.
Unlike other responses, I'll question why you're subclassing
NSMutableDictionary for this. I would subclass NSMutableDictionary to
provide a new "kind" of dictionary -- e.g., one that uses a different
internal representation -- rather than because I want to use an
NSMutableDictionary as backing store for an instance of an object.
In the latter case, I'd just have an NSMutabelDictionary as an
instance variable, and have the appropriate accessor methods in my
class call through to it. The general rule of thumb is to use
subclassing for "is-a" relationships between classes and composition
for "has-a" relationships.
-- Chris
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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