Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^5: A brief survey of the DBI usability layer modules on the CPAN

by siracusa (Friar)
on Nov 03, 2005 at 15:59 UTC ( #505409=note: print w/ replies, xml ) Need Help??


in reply to Re^4: A brief survey of the DBI usability layer modules on the CPAN
in thread A brief survey of the DBI usability layer modules on the CPAN

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.


Comment on Re^5: A brief survey of the DBI usability layer modules on the CPAN

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://505409]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (13)
As of 2014-10-23 18:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (127 votes), past polls