I've spent two days writing server admin scripts in Java to be run via Ant. I think the only way to do it and not go insane or build a YAFF is via Command objects. You get some measure of recomposition/reuse from your function chunks that way. Otherwise everything turns into single class hairball. Always split iteration from function. I despair that Java can't pass methods around. A little Java, a few Patterns is the best book on writing commands in Java - if you look at that and go "That's not Java", I don't blame you (tip: eat before you read it). Assuming the things you're dealing with have names, RDF makes for a kicking log/journal format. If they don't have names, give them some. The DOM: uurrghhhhh. The next time I do this I'm using Groovy. And XOM....