New Adventures in Software


In Praise of JiBX

Posted in Java by Dan on July 16th, 2007


My previous post, about the Apache Commons libraries, and Commons Lang in particular, was slightly controversial and generated quite a few responses (well, at least it shows that somebody is reading this stuff). Criticising the efforts of Open Source contributors is a little harsh (how does Hani sleep at night? :) ) since people are putting a lot of their time into their projects and giving their stuff away for free to anybody who finds it useful. Anyway, in an attempt at karmic realignment (or something like that), this post is in recognition of an excellent Open Source Java library.

JiBX is a library for XML data-binding. I’ve used it on a few projects over the last year or so. I used to use Castor XML. Castor had its quirks, but it worked. I decided to explore JiBX as an alternative when I saw the eye-opening BindMark performance benchmarks. JiBX’s elegant mapping mechanism made the conversion of the project I was working on pretty straightforward (without any of the awkward corner cases I came across with Castor). One quick performance test was enough to confirm that I wouldn’t ever be going back to Castor. The conversion to JiBX made the XML <-> POJO translations nine times faster.

The simpler mapping and astonishing performance boost were not the only plus-points. JiBX achieves its performance by using post-compilation bytecode manipulation rather than the reflection approach adopted by Castor and other similarly invasive XML data-binding solutions. This has the advantage that it places fewer demands on the way that you write your mapped classes. There is no need for getters, setters and no-arg constructors just to satisfy the tools. Most of the time you can write the class without considering mapping issues and then map it without modifications.

Denis Sosnoski shows what can be achieved by a single developer project. The code is clean, the documentation is good and the end result is a piece of software that I wouldn’t hesistate to recommend.

Want more articles like this? Subscribe to the feed.

2 Responses to 'In Praise of JiBX'

Subscribe to comments with RSS

  1. Hani Suleiman said,

    on July 17th, 2007 at 12:43 am

    JiBX is indeed a fine library, though I have to (still!) take exception at your opening paragraph. Just because something is free and someone is willing to do it does NOT automatically make it worthwhile or valuable. I’m sure you could probably find plenty of people willing to ‘volunteer’ their ‘free time’ to come ‘crap on your doorstep’. Is criticising them harsh, given that they’re choosing to do what they love in their own time and are making it freely available to you?

  2. Dan said,

    on July 17th, 2007 at 8:24 am

    I’m not saying that it automatically makes it worthwhile or valuable (I still don’t see the point of much of Commons Lang), just that I feel a bit bad (only slightly) having a go at people for producing something that I don’t have to pay for or use (I’ll leave that to experts like yourself ;) ). Just because the contributors are volunteers is no reason to ignore problems with their work.