Don’t get me wrong, I like xdoclet. I use it in a number of fairly large projects (100+ ejbs). It gets the job done, slowly, but it works. I’ve had nothing but pleasurable dealings with Ara and Aslak. In fact it was Ara’s speedy responses and acceptance of patches that made me feel that it’s worth sticking with xdoclet. I do not regret that decision at all.
However…all is not well in the xdoclet world. XDoclet suffers from a number of fairly serious problems. I realise that xdoclet2 addresses a number of these, but for now xdoclet2 is nowhere near release, so I can pour my vitriol on xdoclet without feeling too guilty.
First of all, xdoclet suffers from astounding amounts of bloat. Picture IBM Websphere scale bloat. Picture TogetherJ (or TCC for the newer kids on the block). As much as I like hurling about abuse without substantiating it with much evidence, xdoclet luckily (for me at least) provides plenty of ammo. Let’s start with the ingenious plan of internationalising build messages. Yes folks, you heard it right. The XDoclet team has spent much effort in ensuring that their BUILD MESSAGES are internationalised. What is even more astounding is that some people have the gall to say that this is a great idea and a wise investment of time. No big deal, most of you shrug away and think, so what if they use a bunch of localised bundles and use keys off of them to output their build messages. Hardly a huge cost or that much trouble. I mean, resource bundles degrade nicely into the default locale anyway.
Haha! Fools! XDoclet uses its own, invented from scratch obscene monstrosity and dares call it a translator tool. What this ingenious little subsystem does is…well….it’s complicated, but lets just say it works exactly like MessageFormat. Yes, the very MessageFormat that comes for free in every JDK. Oh, the keys are also all hardcoded into some class too. So if you ever feel like adding a more helpful error message somewhere, you have to change 2-3 files at least. Needless to say, it’s impossible to actually identify if this new error message you want to throw is something someone already thought of. Either you’re the lucky chap who wrote all the keys in the first place and knows where they are, or you’re doomed to a) duplicate keys, or b) spend a few hours trying to track down the appropriate key to use. If you choose option b, you will start to hate your life and want to commit random acts of violence, so I’d advise against it.
Still, someone already did all the work, it’s all done now, it works, there’s no problem. Ha! wishful thinking. Let me just run an xdoclet build now and see what fun stuff shows up….Oh look: [xdoclet] RUNNING_TASKNAME arguments: [Ljava.lang.String;@e99fb6. Ah well, one rogue key isn't such a big deal. Oops, no, here comes: [xdoclet] GENERATING_TEMPLATE_OUTPUT_SINGLE_FILE arguments: [Ljava.lang.String;@988f4b. Lest you start making the ‘it’s CVS, it sometimes is messy’ excuse, I’ll have you know that these kind of messages have been there for months. In fact, ever since this wonderful new Translator subsystem was vomited into CVS.
Still, overall, it’s a good thing right? XDoclet is a truly international tool. All the languages it supports must mean it has a much lower barrier to entry. Err, wrong again. For all that fuss, the only translations available that I can see are English and Brazilian Portugese.
Moving on swiftly, let us consider the error reporting. If by some unhappy chance you stumble upon a problem in a template, then you have two choices. The first is to try and figure out which of the 10 pages of stacktrace has the secret info you seek, and the other is to beg and plead for someone to fix it. The first option requires a lot of spare time and patience. Especially as there are no tools to make the process vaguely comfortable. You need to invoke ant for everything. The second option is laughable, given that chances are,the person who wrote the template has now moved onto bigger and better things and will gleefully tell you it’s no longer maintained. Oh, and if you find the first option too easy, xdoclet will spice up your life by providing completely incorrect and random line numbers for the templates.
Still, it’s a heavily used tool, with a big developer community right? Many submitted patches and suchlike. Yep, that’s certainly true. However, it’s still a crapshoot whether anyone bothers checking your testcase and/or bugreport and/or patch. If you’re lucky some kind developer might take pity on you one day and commit it. If you’re unlucky it’ll be assigned to someone who finds the whole thing rather irritating and deals with it by pretending to be an inanimate object. Of course, if you’re stupid enough to report a bug without a testcase or a fix, everyone will just laugh and point.
Of course, you could be one of the lucky ones who happens to use the latest fashionable technology. If you use hibernate for instance, you’re in luck because it’s very much a flavour of the month. God help you in six months time though when all the cool kids have moved onto the next great thing and you’re stuck maintaining an unfashionable dependency that nobody cares about anymore.
Another problem with xdoclet is that it gives you enough rope to hang both yourself and a small village from the third world nation of your choice. Suddenly it’s become reasonable to embed datasources in java source code. Suddenly people want to configure their clustering from inside of java code. All the advantage of deployment time configuration wiped out by some thoughtless module writers. Just look at all the filthy things the struts people are adding, it’s enough to make one cry hot tears of shame into one’s soup.
Having said all that, it’s still a tool I use on a daily basis, so go out and use it and don’t be put off by these minor quibbles.