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

Re: object newbie



Mark Hadfield wrote:
> 
[...]

> 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.
> 

... to elaborate (because Chip calls himself an object newbie): I have
an example where I store among other things an array of structures
(actually objects of the same type) in the object (and I am in fact
using a container for this). Say this structure array is named
"campaigns". In my GetProperty method I then have keywords to access 
  - the complete array as objects       campaigns=campaigns
  - the campaigns data as structrues    struc_campaigns=struc_campaigns
  - only the campaign names             cnames=cnames
  - only the campaign dates             cdates=cdates
etc.

Specific retrieval methods (usually functions then) enhance the
flexibility of the access. E.g.
   GetCampaignDates(name=name)   can be used to retrieve the dates for
campaigns selected by name
                                 (including a pattern match) -- this is
something I would consider
                                 "value added feature" when you use
objects.

The GetProperty method may in fact use the special retrieval methods to
extract things. As long as you store only small amounts of data, it
won't matter if you access the campaigns structure array several times
and pass parts of it between methods. If you envision huge amounts of
data you may want to think more carefully how often these arrays must be
copied. I haven't dealt with these issues yet, but I would be happy to
hear comments.


Cheers,
Martin


-- 
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[ Dr. Martin Schultz   Max-Planck-Institut fuer Meteorologie    [[
[[                      Bundesstr. 55, 20146 Hamburg             [[
[[                      phone: +49 40 41173-308                  [[
[[                      fax:   +49 40 41173-298                  [[
[[ martin.schultz@dkrz.de                                        [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[