The problem with declarative schemas for ORMs

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at:

The schema-generative ORM paradigm is fundamentally flawed:

Modeling is one of the fundamental challenges of software development. Capable developers prefer highly expressive or unconstrained type systems to aid with modeling. Generally, runtime type systems are more expressive than those found in databases. Declarative relational mappers, however, constrain the programming language type system to its less expressive counterpart. When building domain objects, the developer must think in terms of the database’s type system, not the programming language’s.

While using a declarative object relational mapper, developers are effectively trying to design storage and runtime models simultaneously. On average, superior results are achieved by modeling these two concerns separately and then solving an additional subproblem: serialization mapping. You might wind up with slightly more code, but it will be easier to understand and maintain.

I worked on a framework 2006-2007 that generated the code models from the database, with certain magic names to allow a programmer to shape the code. I’m tempted to go back to working on it.