It's phenomenally easy to abuse object relational mappers (ORMs). I see all sorts of silly things going on with them and I'm cocky enough to think that I can avoid the worst of problems with them, but I'm humble enough (ha!) to know that others can give me great suggestions.

I want to do a write-up for my O'Reilly blog about how to minimize problems with ORMs. There are plenty of articles about which ORM to use or whether you should use them, but I want to focus on how to use them properly if you must. The important thing is to actually understand object-oriented programming and how an ORM can hinder this when abused. Thus, the goal is primarily to not treat the ORM classes as your actual object layer, but to have them hidden by your object layer (or model, if you prefer).

What techniques would you have for others to adopt or avoid when using ORMs? If fact, when would you choose to use or not use an ORM? (Note, I'm assuming you think there might be some proper role for an ORM. I've read plenty of "never" arguments and that's not what I'm looking for here.)

Cheers,
Ovid

New address of my CGI Course.


In reply to Whip Me, Beat Me, Make Me Use ORMs by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.