Tuesday, December 12, 2006

Why I truly, honestly dislike Hibernate


It was such a promise and of course such a letdown. Model driven approach, forward engineer your Java classes, have Hibernate persist them to rdbms behind the scenes. It was the single greatest risk of the project.

First it took ages to incorporate into the generator some of the history and many to many options. Straightforward dog house style classes are easy, the rest requires serious investing in time. So we lost a quarter on that, trying to get it right - and not the smallest minds, but a combination of dbms aces and math majors.

Then - we could not delete objects. Just. Could not delete. Some spooky discord between lazy instantiation and session handling. Some things were not committed. Some things were not really multiuser, and the system balked at having two people working at the same time on an admin screen.

We had it investigated, some of those very highly paid highly focused nerds. It came out our session handling was 'all wrong.' Where you normally, the last 20 years I am in rdbms at least, open a session, have transactions and close it (or have it closed by the OS) when you are done, this thing refused to commit. And had a singleton session object, that forgot about your work when someone else used it. Brrr. So we had a very traumatic rewrite of session handling - ah yes, and the consultant deemed Hibernate2 so bad that we had to fall forward to Hibernate3.

The rewrite literally yielded hundreds of bugs. Simple select from things failed, and the session.iterate calls from their own Hibernate2 manuals were deprecated - it was laughable to use them, they did a select for every row. Presented in a way like we were stupid, only, we were not, because it was all in their own samples and nobody told us about the depth of this stupidity - in their own docs.

Now switched to a default of all lazy instantiation (and yes, the statements from a moderately deep inheritance hierarchy already ran out of DB2's JDBC statement buffer), we had to change SQL Query syntax to very unnatural select from StaffMember left join fetch HisName left join fetch HerSocialSecurityNumber etc. Otherwise you get Null Pointers.

So they managed to change query semantics so that everybody that knows his SQL is a total beginner again and has to adapt to funny quirks. So enough. Out with it. It is the emperors new clothes. Let it sleep.

Now the sad part of it is that in the years before this happened, we had written our own O/R layer, that, erm ... just worked. It was people that did not trust this beautiful small piece of technology that suggested using Hibernate for the big, important project. We thought by giving in, they would help us building the system. They did not. Darn them to Heck. Let them forever Hibernate.

Saturday, December 09, 2006

The Workers Movement - Rexx users

Of course I keep my eye on other languages - Java, because its widespread use and excellent VM and Library, Prolog, because it is mighty interesting and lately Ruby, JRuby to be precise. We have seen the enormous inroads Ruby made, and it made me wonder why Object Rexx is not nearly as popular. (Not that I do not know. It is a rethorical wonder).

It is easy to blame IBM, especially because it probably is the guilty party in this. I like some things in Ruby, because they are done in a straightforward, totally consistent way, and I don't mean the Perl-isms that linger. Rexx deserves a clean up with deprecation of old stuff - in the teaching materials at least. Falling through procedures without an exit, 'expose', stem variables. Most of it is done, and we have to take care of a very large installed base. Of which todays vocal programming youth does not know anything.

I failed to see Ruby emerging the way it did, thinking it was a slow, slightly more OO variant of Python, which I sincerely dislike, even coming out of Amsterdam - it must be the indentation levels thing, reminding me of COBOL A-margin and B-Margin, being the last time that I struggled with whitespace, twenty years ago., before Python came around.

Ruby has got a great community and some visible protagonists, like Martin Fowler and Bruce Tate. And Tim Bray. I am afraid the Rexx community does not have this visible array of foremen; we are stronger in the department of system programmers and administrators that were not actually allowed to write applications but did thanks to Rexx. And people of the world, most of your payments go through with some Rexx application, transformation or maintenance program to thank for. We, the Rexx community, are a force of thousands, but thousands that do their work quietly and unnoticed.

The sad thing is that we had most of the things the community opinion leaders of Ruby like in Ruby, in Rexx, NetRexx and ooRexx, years ago.

IBM botched a lot. Moving development, losing some five years in the gestation of Open Object Rexx, charging for it to people. Coupling its name to OS/2 which it hated itself, being bred on very misguided MS cooperative principles - and then letting it drown, ruining its reputation in the process. IBM also saved it by Open Sourcing it in 2004.

We have to publish. Books and Articles. That do not say 'unknown, underrated.' But proud and showing off really advanced working stuff. Unlimited Numeric Precision, Correct handling of decimal numbers, Trace, Parse. Macro support for applications. Metaprogramming, meta classes, builtin Concurrency. At the same time there must be things added to keep up with the times. You would be amazed how many very important systems run on Rexx. Most of which we are not allowed to talk about. Drat.