[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: object newbie

"David Fanning" <davidf@dfanning.com> wrote in message
> Chip Sample (sample@idcomm.com) writes:
> > I eventually came on a work around to write a "proto_object" with a
> > allowing you to pass a string containing a tag name which returns the
> > contents of the field with that tag name.  This "proto_object" is
> > by all other objects I create just so I can use this method.  Along the
> > I found that the TAG_NAMES function in IDL doesn't work for objects so I
> > to create one.  It basically copies the object structure into a regular
> > structure so the TAG_NAMES can be used.
> >
> > Am I making this too hard?
> No. You are becoming a righteous IDL programmer! :-)

I don't quite agree with David. There is a conventional way of accessing
object properties, i.e. via keywords to the SetProperty and GetProperty
methods. I suggest you explore this convention and get a feel for its
strengths and weaknesses before you try anything else. It's similar to what
you've developed, but it uses keywords rather than strings. This means that
it can take advantage of keyword inheritance and allows abbreviation of
property names. Also object properties are not strictly tied to the class
structure: GetProperty/SetProperty keywords can represent tags in the class
structure or they can be dynamically interpreted, thus hiding the
implementation details.

Mark Hadfield
m.hadfield@niwa.cri.nz  http://katipo.niwa.cri.nz/~hadfield/
National Institute for Water and Atmospheric Research
PO Box 14-901, Wellington, New Zealand