Jan 23
As an attempt to promote X2J, my XML easy binding framework, I might start up a fun contest soon. The contest would be about finding bugs and solutions to bugs (not really hard to find Bugs, but looking into a code I’ve written is not considered as fun), and about suggesting features and feature implementation suggestions.
The contesters would be rated according to bug relevance, fix suggestion’s quality, feature relevance, and feature implementation’s suggestion’s quality. Regarding the prize, I’m having a few things in mind but would accept new ideas.
For more information, either comment here or mail me at avah [at] crazyredpanda [dot] com.
Jan 18
Unit testing is cruicial. If there is Anything you can say about the tools you need in order to create a framework, is that creating unit tests is your safety net when you decide to refactor it completely (and any framework, at its first steps, might go through such a thing – Nothing is ever fully designed for a future feature, not even a complete product.)
A few weeks ago I decided to have a major change to the way X2J analysation works, and use moulds and visitors instead of the previous, “everything-in-one-method” way. This change has worked great for me, but it was scary: What if X2J stopped working?
Sure, I could rollback the code – But that would serve to no good as I still needed this type of change. So I started writing tests. They weren’t JUnit tests, but just regular applications running X2J for me to manually check the results with. It worked, as amateur as it was, and I made the switch.
However, today I face another refactoring of code and I know I can’t do the same thing over again. I need some stability to my code. Some red lights to appear when I do something that risked a totally different part of my application. Something that will tell me almost precisely where I broke the code.
This is where JUnits come in, and if you haven’t been using them, you should do so now. I’m going to start creating them, starting this week. Only then will I tend to my refactoring tasks.
Jan 15
Okay, so its not the highlight of the framework, but its something. Just an example to show that it’s working, both for you and for myself.
You can download the source, and I’ll post here the Recipe and Step classes (the only classes in the application except the Form). There was no XSD needed to read or write the XML document, and as you can see, it’s perfectly readable by any application.

// lang java
@Name("three-step-recipe")
@Root
public class Recipe {
private int prepTime;
private String name;
private Step[] steps;
@Attribute
public int getPreparationTime() {
return prepTime;
}
@Attribute
@Mandatory
public String getName() {
return name;
}
@FixedSequence(3)
@Element
public Step[] getSteps() {
return steps;
}
}
}
@ComplexType
public class Step {
private String title;
@Attribute
@Mandatory
public String getTitle() {
return title;
}
}
Obviously there are setters to complement the getters. I removed them so that the page won’t be too stuffed with code.
And again, you can find the X2J project here.
PS until I manage to instsall this code highlighter, the code text might appear dull and small. Apologies ahead.