On Thu, Sep 30, 2010 at 2:45 PM, jonat...@mugginsoft.com
<jonat...@mugginsoft.com> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to