Re: Changing classes
Re: Changing classes
- Subject: Re: Changing classes
- From: Kyle Sluder <email@hidden>
- Date: Thu, 30 Sep 2010 15:22:22 -0700
On Thu, Sep 30, 2010 at 2:45 PM, email@hidden
<email@hidden> wrote:
> Trying to dynamically match a stepwise revealed information structure to a particular class in a hierarchy sounds fragile.
> If an individual hardware item property doesn't match the class hierarchies expectations then you have to subclass.
This sounds like a good candidate for a descriptor-based approach.
NSFontDescriptor is a good example: you fill it with properties and
then ask the font manager for a font matching that descriptor. In your
case, you'd create a HardwareDescriptor object, fill it with
information you receive over the network, and then ask some factory
method to return you an object of the appropriate class for that
descriptor.
Of course, you might not really need separate classes for each kind of
hardware object you have. You might get along fine with a single
generic HardwareObject class, with a dictionary of attributes, as
Jonathan describes.
--Kyle Sluder
_______________________________________________
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