... And the Law Lost.
My Jury Duty is over. One week long trial, at the end of which we were unable to find the nasty little oik guilty due to the total lack of solid evidence against him, then they let me off early for some reason.
So, I'll be able to go to both London 2.0rc3 this evening, and Freja's school play next week. Top.
Now I have 40 squillion emails and blog entries to catch up on, so if you'll excuse me...
I'm taking the opportunity of all the waiting around time to write some great Python stuff. I'm away from the office for at least two weeks, which is far too great a strech of time to be away from our subversion repository for me to feel that I'll be able to merge stuff back into the trunk if I were to make any big changes, so I can't work on my main project - but I have roadkill with me, and a locker to leave it in while I'm in court, so I have a little side project on the go.
We are finding that we have to write huge swathes of Java code for each new business entity (policy, claim, broker, that kind of thing) that we want to make available for our users - domain objects implementing soft coded rules (in Jython!), data access objects, model view controller classes and the JSPs to go with them, web services and clients, plus interfaces and unit tests for them all, and a ton of config files - it just goes on and on. It's at least couple of days work just to get the basics in place, and it's the worst kind of work - repetitive and boring without being easy.
But it occured to be that 90% of this stuff could be automatically generated from the information in the Hibernate mapping document that we write for each of these entities - more given the fact that Hibernate helpfully allows you to add your own meta tags to your mappings, so I can add stuff to the mappings specifying which fields get shown in which places, for example.
I've not done any serious work in Python for a while - it's been all Java. So it comes as a surprise, once again, how powerful Python is. And how much fun! Nice to be reminded.
Aside from Python itself, there's a wierd kind of synergistic effect you get when you combine various well (Pythonically) designed modules. For example - I'm using classses inheriting from a new-style-class variation on Alex Martellini's Bunch class to store data about the entities in question, and their properties, and I'm using ElementTree to parse the mapping file. (I'm using ElementTree for its elegance here, not for its performance. The mapping files are tiny.) The fact that ElementTree spits out a node's attributes as a dictionary made the data just fall into my objects, so my parser has an obscenely small amount of code considering how much it does, it's still very readable.
Then I use Cheetah to generate the Java code, and again, the fact that Cheetah can be driven by my objects as they are means that the only code that I have to add to them is for derived values (which I'm implementing as properties) - no dross, only real domain logic.
I've pretty much finished the Python code now, I think. :-( Just the rest of the templates to build.
I'm not in work this week or next - I'm on Jury Duty. I'm not allowed to talk about the case - and I don't really want to, if I'm honest. Suffuce to say that my impression of human nature isn't at a high ebb just right now. Especially those humans who reside in Mitcham.
There's a lot of waiting around, but no 'net access, so blogging and email reading will be occasional.
OK, so what's new, right?
Anyway, good luck to Steve at his new job which he started on Monday. Hope it's all going well for you, mate.
Sorry, I'm not going to be able to make Java London this evening. It's a mood thing rather than a time thing. I hope it all goes well, though, Jez. I'm still hoping to manage to get to London 2.0 on Monday.