Re: Constructing class names dynamically
Re: Constructing class names dynamically
- Subject: Re: Constructing class names dynamically
- From: Bill Bumgarner <email@hidden>
- Date: Tue, 13 Jan 2009 13:29:15 -0800
On Jan 13, 2009, at 1:18 PM, Mohan Parthasarathy wrote:
Does this make sense ?
Yes.
Or this is a bad idea ?
Yes.
Generally, anyway, it is indicative of bad design when your code seems
to require dynamic generation of classes.
Not to say that there aren't specific cases where it is warranted --
bridging comes to mind -- but that they are few and far between.
In this case, it sounds like are effectively looking for something
that can do key/value storage, possibly with the ability to monitor
the changes and/or support KVC and the like?
Obviously, i can have a dictionary which can be
keyed in using the "entry" selected which in turn has the relevant
object to
handle the selection.
That'll work fine, no need for a custom class. You could have a
subclass of NSObject that has a name and stores an arbitrary set of
key/value pairs in an NSMutableDictionary backing store (or
NSMapTable, which can handle non-object values). Instances of this
would then be shoved into your dictionary as needed.
b.bum
_______________________________________________
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