• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Constructing class names dynamically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Constructing class names dynamically
      • From: Jean-Daniel Dupas <email@hidden>
References: 
 >Constructing class names dynamically (From: "Mohan Parthasarathy" <email@hidden>)

  • Prev by Date: alternative to NSURLConnection sendSynchronousRequest
  • Next by Date: Re: Constructing class names dynamically
  • Previous by thread: Constructing class names dynamically
  • Next by thread: Re: Constructing class names dynamically
  • Index(es):
    • Date
    • Thread