The end of ORM – Gumtree Dev Team
A link-bait title, I’m aware, but please indulge me while I try to expose some thoughts about ORM and Eventsourcing that have recently crossed my mind. I wish to go down a theory-crafting path exploring these thoughts and I will welcome any comments on the matter. Let’s start with a bit of basic context. Most decent sized applications need to persist information so it can be retrieved later. Traditionally, this has been achieved via use of RDBMS. More recently, NoSQL movement has promoted alternatives. But, in the end, we need a storage area for that data. But this is not without problems. The prevalent development model is based on Object Oriented programming along relational databases. This triggers what is known as Object-relational impedance mismatch, which is a fancy way to say that they don’t work well together for many reasons, some subtle and others not so. This is not a new problem, obviously, and people have tried quite hard to provide a solution or something that eases the pain. From a developer point of view the use of ORM is intended to alleviate the problem, even if only slightly. Tools like Hibernate take care of communication with the relational layer so the developer doesn’t need to spend time on it. They are not perfect, though, and the law of leaky abstractions hits hard. Anyone working with Hibernate may have found pretty inefficient queries being run by the framework, which means it is time for the developer to delve deep and tell the tool how it should be done. But this means going down to a level, the database, which resurfaces the impedance issues mentioned before. So ORM fail as a complete solution. But this must be a pretty serious problem, as we (developers) devote tons of effort to it. Look at this list of relational database access tools for Scala. I count 6 different tools to provide a communication layer between your code (Scala) and the persistence area. We are talking for only one language, not checking Python or Java for similar lists, nor any in-house system developed before ORM were commonplace. And they are good tools, production ready, not pet projects of some developer that wants to experiment.