An interesting post from Ted Neward — he’s rushing to the defense of object databases, which came under attack from Gavin King (a Hibernate bigwig) over on blog.Hibernate.
What really shocks me about this piece is that Gavin King asserts: Object-relational mapping isn’t that hard, so there’s no need to eliminate it. As someone who has spent many long hours fighting with many obscure Hibernate error messages created by poorly-generated SQL and a lack of appropriate magic chanting, this just makes me angry. The ORM problem is one of the hardest and most tedius parts of new process development, because the way things make sense in an object-oriented world isn’t always how they make sense in a relational data world, and often those mappings aren’t as clean-cut as Hibernate needs them to be. Gavin refers to this problem as “really crazy legacy schemas”; Ted refers to it as the “dual schema problem”. Either way, it’s a pain. Beyond that, there’s the entire problem of business constraints on the database: often people aren’t in a position where they can generate new indecies or views, so their options are doubly-limited, and Hibernate is a notoriously poor tool for handling that. The fact that Gavin King has written it off as a solved problem (with a dash of “database refactoring”) just tells me that Hibernate’s leadership is out of touch with the real development work being done by the grunts in the trenches.
One Comment
What would an OO programmer say to some who is claiming that they wrote an OO program, but upon inspection that program only has one class, which is never instantiated? Don’t laugh- I’ve seen code like that.
The nicest thing the OO programmer would probably say is that program isn’t an OO program, it’s a procedural program. OO programs are about manipulating objects, and relationships between objects.
Now, consider a program with very few classes and objects, and almost no interactions between them. OK, slightly more OO, but still really not.
In this sense, the object-relational mapping problem has been solved by throwing away the relational part. SQL works on relations (aka tables aka views) the same way that Java or Ruby work on objects- it’s the chunk size the language is most comfortable with.
By throwing away the relational aspect- the operations on whole tables which is the fundamental concept of relational databases- you throw away what the relational database is best at. So of course it’s going to suck. Try programming Ruby without objects some time.
The hard work to make a real object-relational mapping hasn’t been done yet. It hasn’t even been started yet.
Brian
One Trackback
[...] I knew it wouldn’t be long before I encountered a great example of how Hibernate does not qualify as making ORM easy (despite what Gavin King might say). [...]