Hi Erik

Erik Beeson wrote:
> We use XStream to do all of our serialization, so we get to switch
> between XML and JSON for free, which is really nice.
I've been considering XStream so it's great to hear that it's working
for you, especially regarding JSON.
> Our containers end up really cluttered with a lot of XStream related
> annotations (mainly @XStreamAlias and @XStreamImplicit), so separating
> them helps keep the data POJOs much cleaner.
>
This is why I've never been that keen on annotations.  Keeping this
information external to the POJO would leave them suitable for use in a
client API as Vincent suggests.
> I see places where we could merge some of the POJOs (like make
> incoming and data object the same above), and I see ways that we could
> use even more annotations and merge them all into one, but we don't
> for a few reasons: It would make for much uglier code, this allows
> different developers to work on different aspects of the pipeline
> without having to worry about stepping on toes,
My incoming/outgoing representations are generally the same because they
support a GET - modify PUT cycle.  But I'll bear this in mind.
> and we feel like it's safer since we're never inputting or outputting
> our actual data objects. That means it's harder for us to accidentally
> output a field that we shouldn't, and we don't have to worry so much
> about asserting which fields we can allow incoming data to write to.
>
Spot on.  I'd been struggling to put that into words.
> Plus, our data is pretty straight forward (not a lot of nesting), and
> there aren't that many data objects (less than a dozen), so the
> benefits are worth putting up with a little bit more code.
>
How are you handling circular references/normalization in JSON?  My
prototype uses flat structures and uses the business keys to resolve
references on the client-side (javascript).  But I've noted techniques
for serializing denormalized/circular JSON  (e.g.
http://www.jspon.org/#JSPON%20Core%20Spec).  Have you formed a view?
> Good luck with your setup. I'd be interested to hear what you end up
> deciding on.
There is lots to think about here.  Will keep you posted.

Best regards

Richard

Reply via email to