Wednesday, June 15, 2011

ORM is a dangerous anti-pattern

Oh, oh, oh, this is an article that speaks to my heart! [HNN] Takeaways:
  • Not every object should be in a relational database
  • SQL (RDMBSes in general) answer questions; thus SQL doesn't necessarily map to an object definition. This is so damned important; I need to rework some of my database stuff just on this insight alone.
  • The practice of deriving all SQL from an object model is pernicious: "They'll get you up and running quickly, but you'll be running in the wrong direction."
  • Grouping SQL into one place is a good idea, but in the sense that you are defining an API consisting of answers to questions you can ask your database. I can't say how clarifying that is!
Interestingly, Googling ORM turned up not only object-relational mapping, which the article is about, but also object role mapping, an interesting approach indeed that I want to think about in more detail.

No comments:

Post a Comment