Rabbit’s Feet and Best Practices
I wrote an article just now, about how I replaced a lot of XML driven, reflection based, non-sense, with a Java class heirarchy that was no more or less convoluted, but much, much, faster.
The library creates an event handler that builds Java objects from XML events. The old library used an event handler to build the event handler. The template builder read the description of the template, and build the desired template using reflection. The result, the template that built objects, used reflection constructors and methods to build them.
What I really want is XML driven object construction, and I want it to be quick.
This new version uses a class library. Single method interfaces let the application developer add the one liners to construct the object, or set properties.
Don’t describe the method, name, return type, and parameters. I mean at that point, just call it why doncha? Stop reflecting on things and write some code.
This rewrite came about because I recently lost my aversion to anonymous innner classes.
I was avoiding them. Creating class files to implement a single method. Adding lots of Javadoc.
Worst of all, I’ve basically been working on XML event progamming, without using the langauge constructs added to Java expressly for the purposes of event handling.
It has been a real impediment.
I’m not sure why I adopt rediculous constaints. I’d like to think I know better.
It’s something I heard, I guess. Somewhere, I come across the notion that annonymous inner classes are bad. With everything else I absorb, this one opinioniod escapes critical thinking.
It sticks in my mind like a supersition. It becomes a latter I will not walk under. That’s all that a “best practices” really are.