[omniORB] Object By Value

Mann, Gary (London) MannGar@exchange.uk.ml.com
Thu, 19 Apr 2001 14:11:47 +0100


I also have an application which seems to lend itself readily to OBV. It's
clear to me that a struct will in general do in place of a valuetype if
you're not concerned with object-orientation, but where I really think OBV
could be useful is where specialised containers are required.

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.

Does the above seem reasonable? Am I missing something here? Is there a more
efficient way of passing the contents of richer containers over the wire
that isn't either of the options above?


Gary M. Mann
Debt Derivatives Technology
Merrill Lynch Europe
25 Ropemaker Place
London EC2Y 9LY
020 7867 2640 (Voice)
020 7867 4829 (Fax)
mailto:gary_mann@ml.com