42 ms·
Yes, there is an impedance mismatch in mapping data from relational data stores to object instances. This does not mean ORM's are an anti-pattern, or bad. ORM'
by div 15y ago
Yes, there is an impedance mismatch in mapping data from relational data stores to object instances.
This does not mean ORM's are an anti-pattern, or bad. ORM's provide a lot of value for the 90% use case that people often need to bang out under various time constraints (mvp, project for a customer, etc).
There is a trade-off when using an ORM that you, or your team, should be aware of. Once you start hitting the limits of what an ORM can reasonably do for you, it's fine to either:
- drop down to using handoptimized sql for specific queries / submodules of your project (e.g. a set of reporting pages)
- figure out if you are trying to punch a cube through a circle by using a relational database over a nosql type storage, and consider moving part of your data to a different storage.
I haven't had a lot of experience with nosql databases yet, but I think it's also interesting to consider that relational databases have been around for a long time, and alot of corner cases where they are unwieldy are known. Nosql databases are not as vetted against reality yet, so abolishing one for the other may amount to nothing else than trading one set of problems for another.
- cageface 15y agoAll abstractions leak. The good abstractions make it easy to run some of your own plumbing when this happens. Good ORMs fit this description.
- Peaker 15y agoAll abstractions leak when you're debugging or trying to understand operational behavior of a whole system. But there are plenty of abstractions code virtually never has to plumb around (Many kernel APIs/memory management, network protocols, various programming language abstractions, etc). If an abstraction requires "plumbing around" in almost every project, that is indeed a problem with the abstraction.