[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: object newbie
- Subject: Re: object newbie
- From: marc <m_schellens(at)hotmail.com>
- Date: Sun, 13 Aug 2000 21:04:24 +0900
- Newsgroups: comp.lang.idl-pvwave
- Organization: Institute of Physical & Chemical Research (RIKEN) Saitama,Japan
- References: <email@example.com>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:20817
Chip Sample wrote:
> I must admit that based on comments from this list, I have experimented with
> the object features of IDL for the past week or so, and have implemented
> them in a few places in a fairly big widget code I have written.
> My initial observations are that there seems to be less of a temptation to
> use common blocks when objects are used. On the other hand my first
> impression was that an object is a structure whose fields can not be
> accessed until you write additional "methods" to get at each and every damn
> one of them. So my object was littered with about 25 "methods" just so I
> could pry the data out of the object.
> I eventually came on a work around to write a "proto_object" with a method
> 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 inherited
> by all other objects I create just so I can use this method. Along the way
> I found that the TAG_NAMES function in IDL doesn't work for objects so I had
> 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?
There are a lot of other useful routines Robert Mallozzi offers on his
Seems to me you re-invented the wheel, eh?
But generally objects are more than structures which only hold data.
So if you need every tag returned from your object, perhaps you should
consider to write a method instead, condensing the data to the values
you really need (or take the appropriate actions).
Probably this would made your program more the way object oriented
programs are meant to be.
But of course the problem you had arises typicaly, when using objects
only in some places, together with non-object oriented parts.