Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger
  • Frits Walraven

XML as data transfer mechanism

Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have recently joined a team which has successfully implemented a high performing,robust 3-tier system, using Swing as a front-end, EJB as the middle-tier and Sybase as the data-tier.
The architecture uses XML as the data transfer mechanism between the presentation tier and the business tier. I always thought that it's better to use java objects to pass on the data from the 1st tier to the 2nd tier, because serialization of java objects is much quicker than serialization and deserialization of XML.
Experienced people, could you please put in your thoughts on this one?
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are absolutely right. Though you can use XML as your data transfer format, the importent point is that it doesn't really provide you any tangible benefits. Think about the extra work you are asking your application to do - for each remote call not only do you now have the overhead of the call to contend with, you must now create a Document, serialize it, transmit it, unserialize it and parse it into an new Document, deal with the message and possibly persist it through an ORM layer. The only possible benefit I can see from this route is if your business tier were third party and not within your control - in which case passing Documents which conform to a DTD could be helpful, with regards to keeping method signatures stable, which is straying towards a web services model. This would still be less performant though. And I can't think of any development team which could work like this.
XML in traditional J2EE aps (outside of webservices) in my opinion is best kept in the presentation layer. It is a valid thing to do to render a GUI using say XSLT, but in this case I'd use one of the many Object-to-XML utilities out there and do the work in you're swing client.
Posts: 3892
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amen! I've ranted about this before here on Javaranch so it's good to hear someone else back up my "XML doesn't belong in the business layer" theme.
I didn't say it. I'm just telling you what this tiny ad said.
Two software engineers solve most of the world's problems in one K&R sized book
    Bookmark Topic Watch Topic
  • New Topic