Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Maybe database tables aren't such great "objects," after all ...

by moritz (Cardinal)
on Mar 25, 2011 at 17:02 UTC ( [id://895538]=note: print w/replies, xml ) Need Help??


in reply to Maybe database tables aren't such great "objects," after all ...

I agree with your statement that database row objects are fine intermediate level objects, and often not too well suited for most really high level objects.

That said I find it curious that you complain about not seeing where DB queries happen, and at the same time bemoan the missing abstractions. Abstractions are all about not caring what happens on the low level, so it sounds like you have conflicting goals.

One more thing: you write about an object representing a table - that's not what the usual ORM does. Most really represent use objects for rows. DBIx::Class is a notable exception, it has both the concept of a "result class" (an object of which is a row), and a "result source (class)", an object of which can stand for a table, or intermediate results from DB queries (ie a set of rows).

Having this distinction helps to remove some of the confusion around objects, tables and rows, but of course it doesn't help when you really want higher abstractions.

  • Comment on Re: Maybe database tables aren't such great "objects," after all ...

Replies are listed 'Best First'.
Re^2: Maybe database tables aren't such great "objects," after all ...
by doom (Deacon) on Mar 25, 2011 at 22:23 UTC

    That said I find it curious that you complain about not seeing where DB queries happen, and at the same time bemoan the missing abstractions. Abstractions are all about not caring what happens on the low level, so it sounds like you have conflicting goals.
    My take on this is that a relational database already has a lot of high-level abstractions going on, and the trouble with ORM mappers (or the way a lot of them are used) is that they dump these abstractions and actually take a step down the scale.

    (Think about it: which is a higher level language: perl or SQL?)

Re^2: Maybe database tables aren't such great "objects," after all ...
by sundialsvc4 (Abbot) on Mar 25, 2011 at 18:02 UTC

    I don’t mean to use the word, “complain.”   Rather, I meditate on what is the most-appropriate use of these classes, having observed a case which (in my mind) does not properly apply their strengths or reap their benefits in the best way.   The issue of “using outside SQL” (the necessity of it, the (dis)advantages of it, what to do when nothing else is as clear, etc. etc. etc.) is another koan entirely.   They truly are “meditations,” because there are no pat answers to be found.   “Everything is a trade-off.   How and what, then, shall you choose to trade?”   Indeed.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-26 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found