[jdom-interest] Re: EJB Mapper (was Newbie: JDom-Test)

Alex Chaffee guru at edamame.stinky.com
Sat Oct 7 13:02:02 PDT 2000


> Directly returning Java bytecode,

Um, you mean returning binary data values via JRMP.  Bytecode doesn't
get serialized in RMI.

> in the object format that it
> represents, will always, always, always be simpler and faster than
> converting to XML.

Faster, yes.  Simpler, yes, *if* you're going to keep it as Java on
the other end.  But if the RMI/EJB client is going to push XML to one
of its clients (say, it's a SOAP servlet), it may be simpler for the
client to receive XML and then either output or XSL-transform it...
There's no reason the EJB server needs to do the transformation from
Java->XML, though, unless you want to make life simpler for your
clients, at the expense of transmission speed.

> And as for Alex's comment that "I already wrote my
> bean code", I don't go for it. One, you can actually have your bean
> extend the value object (although I talk against that in general - lots
> of reasons), you can also just copy/paste... is that not the ultimate in
> ease ;-)

You just recommended two non-solutions.  Using inheritance to build
your EJB is just asking for trouble, and copy-and-paste is not code
reuse:

 * After you paste, you'll have to go and check and probably modify
each line anyway, introducing the chance of bugs or compiler errors,
and negating any time savings versus just coding a value object from
scratch

 * Any properties you add/remove in one later on will need to be
added/removed in the other, leading to possible subtle bugs and
migration (version sync) errors

Got any real alternative rationalizations for why EJB developers
should be forced to write their beans twice?

If *I* wrote the EJB spec, I'd have turned it upside down, using
delegation instead of inheritance.  There would be a Value Object
which would literally be a JavaBean, without dependencies, and a
Business Object that is given a pointer to its Value Object, which
serves the purpose of the current EJB and/or EJBObject.  Then you
could easily ask the server getValue() and it would serialize just the
value object, without all the messy wrapper crap.

But this is seriously off-topic, and I have to go do my taxes now.
Yes, I know, I'm a little late.  :-)

 - A

-- 
Alex Chaffee                       mailto:alex at jguru.com
jGuru - Java News and FAQs         http://www.jguru.com/alex/
Creator of Gamelan                 http://www.gamelan.com/
Founder of Purple Technology       http://www.purpletech.com/
Curator of Stinky Art Collective   http://www.stinky.com/



More information about the jdom-interest mailing list