xml-xmlbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <rdon...@apache.org>
Subject Re: Start-with-java annotations
Date Tue, 25 Nov 2003 23:20:02 GMT
On 25 Nov 2003, at 00:53, Patrick Calahan wrote:
> Hi Robert.  Sorry for the delay in getting back to you.

hi patrick

i'm often tied up with stuff in jakartaland and haven't had time to 
catch up on the xml-beans list before now. if you agree to forget about 
my delay's, i'll forget yours :)

> At 10:28 PM 11/18/2003 +0000, robert burrell donkin wrote:
>
>
> FWIW a couple of obesrvations (IMHO, of course):
>
> 1. castor is very widely used but not as widely liked by developers as 
> it's usage suggests. (i think that it
>
> Sure, but doesn't that beg the question?  If Castor has a large 
> audience held captive only by the absence of a better alternative, 
> wouldn't it behoove xmlbeans to strive to be (among other things) 
> exactly such an alternative?

yep. agreed (so long as the alternative means "beyond caster" rather 
than "just caster")

(just pointing out something i've personally observed but i haven't 
used castor a lot and so it's probably not too biased ;)

>  loses a lot from being a general mapping tool rather than a 
> specialist xml one.)
>
> Is Castor really general-purpose?  I've only used Castor a little bit 
> myself, but AFICT, it seems to me to have an XML-focused piece, and a 
> JDO-focused piece, and some limited integration between the two.  The 
> XML piece does seem to be pretty specialized for XML.

it's field-oriented whereas most java developers are method-oriented. 
it's language is unintuitive. IMHO this is because castor decided that 
it'd solve other kinds of object mapping (eg. JDO). IIRC the various 
mappings share a common nomenclature and shape. i'm not a castor expert 
so i'd best stop repeating gossip now...

> 2. it's not really object serialization but round trip mapping that 
> developers want. in fact, i think that attempting object serialization 
> is positively harmful.
>
> maybe point 2 needs a little expansion: serialization must be 
> essentially lose-less in a java sense. i'd say that object round 
> tripping means being able to go from a symantically meaningful object 
> graph to an (easily) human readable (and symantically meaningful) xml 
> document and then back to an object graph which is equivalent to the 
> original.
>
> I'm a little confused about the distinction you are drawing between 
> round-tripping and serialization.  'How is loss-less in the java 
> sense' different from getting back 'an object which is equivalent to 
> the original?'

i'd say that serialization means ensuring that every field value is 
equal. equivalence might not mean equal but just equal enough.

another example: a floating point property backed by a field. the 
business logic of the bean might say that this is really a 2 point 
decimal value (yes, i know that floats are inappropriate for this - but 
they are widely misused in this way and it's an easy example). a good 
serializer will record the current value so that it can be recreated. 
but in many use cases, what's really wanted is that the value rounded 
to 2 dps. a good round tripper will allow symantically equivalent 
values (1.11222322341234 and 1.11) even if this results in a loss of 
information and possible non-equality.


one way to solve this is to allow users to flavour mappings with 
additional information to allow different transformations to be 
performed. i think that it's only objects (or primitives) mapped to 
strings (atomics would probably be a good description) that this is 
really important for. (or at least: i can't think of an and i've never 
had a request for this functionality.)

- robert

- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Mime
View raw message