Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Fine, so you could use an ORM to simplify this code. But you can do that just as well using something like SQL::Abstract – and that way you also avoids the overhead and opacity introduced by an ORM.

But then you miss out on the advantages of dealing with objects instead of just bare row and column data in the calling code. And if you decide to dress up the rows returned by DBI-style queries by using that data to initialize objects, well, you're basically writing your own mini ORM at that point.

So I find that depending on the side from which you look at it, ORMs are either too much abstraction or too little, but never right.

I find that they're a happy medium that I rarely need to stray far from in either direction. I've already described when I do when I need something lower-level. In the cases where a higher-level abstraction is needed, I tend to aggregate ORM objects inside the higher level object.

Basically, the higher the abstraction, the more layers I want between me and plain DBI. I end up with something like HLO -> ORM -> DBI. (HLO: High Level Objects). Of course, in most cases, the ORM doesn't use straight DBI either, so it's really HLO -> ORM -> SQLH -> DBI. (SQLH: SQL Helper, like SQL::Abstract and friends.) Why so many layers? Because I want some well-defined API at each level that I'm likely to reach down to. A gulf of non-public code between HLO and DBI is not to my liking. HLO -> SQLH -> DBI is better, but I still like that extra ORM layer because it's the one I work directly with most often.


In reply to Re^5: A brief survey of the DBI usability layer modules on the CPAN by siracusa
in thread A brief survey of the DBI usability layer modules on the CPAN by Aristotle

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-03-29 12:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found