[omniORB] Object By Value
Stephen Crawley
crawley@dstc.edu.au
Tue, 24 Apr 2001 10:01:47 +1000
[My commnts at end ... ]
> Take the example of a "dictionary" container (either a hashtable or map).
> Such a container is not supported directly by CORBA, so you're presented
> with two options:
> 1) You flatten the dictionary into a CORBA sequence, transmit it over the
> wire, and then copy the contents of the sequence back into a dictionary at
> the other end, or
> 2) You use a custom valuetype to write your own marshalling code. The
> implementation of the custom valuetype contains a dictionary (by
> aggregation). The skeletons you write marshal data directly between the
> serialised stream and the dictionary storage.
>
> Option 2 seems more efficient to me since you're eliminating the overhead of
> the copy operation at the client (dict to seq) and at the server (seq to
> dict). This is because the data has already been copied once by the code
> emitted by the IDL compiler. The custom valuetype need not contain any
> methods (i.e. it's just a placeholder for the marshalling methods). However,
> you could define methods within the custom valuetype if you also wanted a
> coherent interface defined across platform.
>
> Of course the big disadvantage of custom valuetypes seems to me to be the
> fact that the IDL is no longer complete - i.e. you're forced to write and
> distribute custom marshalling code within skeletons usable at both the
> client and server. Depending on the number of languages/platforms in use,
> this could be a lot of code.
There is also the issue that the implementation behaviour must be the
same at both ends. In your example, this means that you must ensure
that the hashing function you use gives the same answer across all languages
and platforms. This is a lot harder than it might seem. For example,
you have to worry about the possibility of codeset conversion changing
hash values for character and string types.
-- Steve