Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://505409]
[marto]: so I have to work Saturday, which is good and bad. Bad in the sense that I have to be hear early :( Good in that I am here only as support for another client project, so I get to spend the day working on my personal 'ToDo' list, without the kids :P
[Corion]: marto: Ooof - but yes, being there as only second level support or third level support is good and if you have enough things that you can work on, it won't be a wasted (if paid) day
[marto]: I've opted for a day off later on, rather than pay. I only have to do about 45 mins work for the client, but do need to hang around
[Corion]: marto: Even better ;)

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2017-02-28 10:08 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (399 votes). Check out past polls.