Dropping JAXB

For Coconut, the side software project I work on, I used to use the JAXB package from Sun. JAXB can parse schemas and generates classes that handle representing XML documents as a tree of objects.

It sounds good in theory, but I ran into two problems in using it:

  1. Schemas don’t seem to be very good at specifying really wacky rules. It can do it, but it gets very verbose. The main case I ran into was that I had a tree of elements defined, and depending on the value on an attribute near the root of the tree, the validity rules of the rest of the tree changed very slightly. e.g. a XML document representing “John Doe” may or may not have a street address element; however, if his street address is specified, then a sibling element for the postal code is mandatory.
  2. JAXB generates a set of classes. I then go on to use those classes in the rest of the application, by classes containing business logic. However, those classes are sensitive to the schema. The schema is not an international standard – it’s just my current expectations on a custom message format. Thus, it’s subject to churn, which causes the object model to churn, which causes a lot of breakage. This is worsened by the previous point, that seemingly small rule adjustments cause great increases in schema verbosity.

I’m not particularly well-versed in schemas, and I picked up JAXB based on a high level description from a coworker; it’s possible I’m misunderstanding something. However, in hindsight I should have known better, as I’ve worked on another project that used an XML schema (with a standards body) to generate a core object model – that one didn’t turn out well either.

Outsmarted again

I hate being outsmarted by my cat. She figured out how to use my new laser printer to reach the shelf that hitherto was out of reach (and consequently had unapproved kitty toys, like unused AA batteries). Funny that she’s so smart at getting past all the obstacles I put on her behaviour, yet she’ll ignore me when I ask her to do a simple trick for food. Or maybe that’s an indication of how smart she is, too. :)

iTunes for Windows skipping

My audio player of choice is usually foobar2000, but I do like iTunes as well. It integrates a lot of different features, particularly a radio directory, and podcast facilities, that I find quite useful. It’s also pretty. :)

However, I found that iTunes skips (playing a podcast or radio stream) when I did something else on the computer that incurred non-trivial hard disk activity. A quick search on Google found me the blog entry How to make iTunes for Windows stop skipping, but I don’t think it’s a satisfactory solution. Setting the output device to waveOut causes mixing problems (an artificial example is playing iTunes and watching a DVD) – IIRC it prevents mixing entirely, although fact searching that seems to say it’s merely prone to problems.

At any rate, I seem to have fixed my problem by following the same approximate steps (Control Panel, QuickTime, Sound Out), but using Options to increase the buffer size from the default 120ms to 1200ms, instead of changing the output device away from DirectSound. Makes sense in a way, although I’m not sure why a radio stream would be affected by hard disk activity.

Follow

Get every new post delivered to your Inbox.