SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Enthusiast mjlivelyjr's Avatar
    Join Date
    Dec 2003
    Location
    Post Falls, ID, US
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Object/Relational Mapping (overcoming pesky impedance)

    I am doing some research on object/relational mapping patterns for get object data persisted into a relational DBMS. I am hoping to just get a broader understanding of different ways to do things mostly. I found a fairly in-depth site that has some good concepts to build on (http://www.objectarchitects.de/Objec...erns/index.htm) but I am looking for more. Have any of y'all dealt much with this concept? What are your thoughts? and do you have any good resources?

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This topic has been discussed to death here at these forums. Just search the threads here and you will find all kinds of stuff to help point you in the right direction.

  3. #3
    ********* Victim lastcraft's Avatar
    Join Date
    Apr 2003
    Location
    London
    Posts
    2,423
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi...

    Quote Originally Posted by mjlivelyjr
    I am doing some research on object/relational mapping patterns for get object data persisted into a relational DBMS.
    I put "persistence" into the Sitepoint search and got...

    http://www.sitepoint.com/forums/show...ht=persistence
    http://www.sitepoint.com/forums/show...ht=persistence
    http://www.sitepoint.com/forums/show...ht=persistence
    http://www.sitepoint.com/forums/show...ht=persistence
    http://www.sitepoint.com/forums/show...ht=persistence
    http://www.sitepoint.com/forums/show...ht=persistence
    http://www.sitepoint.com/forums/show...ht=persistence
    http://www.sitepoint.com/forums/show...ht=persistence
    http://www.sitepoint.com/forums/show...ht=persistence
    http://www.sitepoint.com/forums/show...ht=persistence

    ...and that was just the first page of results . There is a good percentage of tool recommendations and actual code in these. Also Hans Lellelid (Propel, Creole) and Manuel Lemos (Metabase, Metastorage) are active on this forum as well.

    Welcome to Sitepoint .

    yours, Marcus
    Marcus Baker
    Testing: SimpleTest, Cgreen, Fakemail
    Other: Phemto dependency injector
    Books: PHP in Action, 97 things

  4. #4
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.agiledata.org/essays/mappingObjects.html
    http://www.agiledata.org/essays/rela...Databases.html

    Some references I go back to whenever I have some spare time. In fact the whole agile site is worth exploring some more

  5. #5
    SitePoint Enthusiast mjlivelyjr's Avatar
    Join Date
    Dec 2003
    Location
    Post Falls, ID, US
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Reading back on my post it does sound kind of "noobish."

    I should have expounded a little bit more one exactly what I was looking for, but I did find some good info anyhow. I was actually searching for "object relational impedance" instead of "persistance." That'll teach me to be specific :P. Maybe I should just use the terms everyone else does next time.

    I found this post: http://www.sitepoint.com/forums/show...ht=persistence particularly helpful, thanks Marcus. You mentioned in one of the other threads (http://www.sitepoint.com/forums/show...ht=persistence) having written an article on the subject. I am assuming the article doesn't mean that first thread. Do you have a link to the article? Does it go the same direction as your forum thread does ?

    I'm not really looking for your common everyday run of the mill Data Access Object Tutorials. I have created many different variants of DAOs some to great success and some, quite frankly, I have just thrown into oblivion. I find that quite frequently most DAOs I employ whether I have created them or someone else has created them do 2 things:

    1. They frequently result in too much data being returned from the server which on a heavily utilized system could eat up bandwidth or cause unneccessary slow downs. Caching gets around this and normally should be used anyways but that still doesn't negate the fact that you could consider this a 'con' of the DAOs. Granted with any form of object to relational mapping this is going to happen. This isn't the biggest of my two concerns anyways.

    2. They also many times won't retrieve enough data in one query. I have as of yet to see a DAO that handles table joins, complicated grouping or 'where' clauses elegantly. This usually results in the DAO making lots and lots of queries where you could possibly hard code one or two queries to retrieve the same data.

    Now please don't interperet this as me saying that all current DAO implementations suck. I do afterall use them myself. I just feel like with some good hard digging I can discover something that works better.

    I think I am already on the right track with the article I found and the forum thread Marcus gave me.

    Again, sorry for sounding uninformed if not just downright stupid. I suppose I could claim stupidity for not using the right search.

  6. #6
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you stupid? Nah, of course your not

    I have as of yet to see a DAO that handles table joins, complicated grouping or 'where' clauses elegantly.
    You've hit the nail on the head basically. I've yet to find an elegant way around this myself so we're all in the same boat really

    What I think would be a great benifit in this area is code generation? Surely if XML was employed properly, wouldn't JOINs be a non issue?

    Have you looked into code generation yet... You've not said anything yet, and I've not yet had a chance to read Lastcraft's urls either.

  7. #7
    SitePoint Enthusiast mjlivelyjr's Avatar
    Join Date
    Dec 2003
    Location
    Post Falls, ID, US
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have had some experience.

    The first package I dealt with kind of used the code generation technique: DB_DataObject (it's actually a pear package). It's kind of what you are talking about. It doesn't use XML though. If I remember correctly it is driven via ini files. If I remember right (I used this about 2 years ago It seems) I wasn't a big fan of how it structured the generated code and it suffered from lack of flexibility when doing more complicated SELECTs in a database. I seem to remember it handled joins well though.

    I also did a short stint of work for ZenTracker (A trouble ticket system) and they utilized metabase which I know defines the schemas in XML but I am not sure what kind of access options it provides (ie. whether or not it generates code)

    The only thing that scares me about generating code is the whole reason I started looking into some DAO alternatives is that my firm wants to roll out some new versions of our e-commerce and online database management suites that support customization of fields. I would have to think a little bit about to see if crunching out new source files is a viable option everytime the schema is updated. At first thought it doesn't seem like it would hurt too much as long as I could lockdown access while the files were generated. There's nothing like obscur error messages to tick your clients off.
    Mike Lively
    Digital Sandwich - MMM MMM Good

  8. #8
    SitePoint Guru
    Join Date
    Dec 2003
    Location
    oz
    Posts
    819
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mjlivelyjr
    2. They also many times won't retrieve enough data in one query. I have as of yet to see a DAO that handles table joins, complicated grouping or 'where' clauses elegantly. This usually results in the DAO making lots and lots of queries where you could possibly hard code one or two queries to retrieve the same data.
    This, along with most things you mentioned is discussed with a multitude of solutions in PoEEA: http://www.amazon.com/exec/obidos/tg...books&n=507846

    It has been discussed in depth in these forums and I'm sure you have checked out some of the links. But they don't explain it in the depth that the book does.

    Eli

  9. #9
    ********* Victim lastcraft's Avatar
    Join Date
    Apr 2003
    Location
    London
    Posts
    2,423
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi...

    Quote Originally Posted by mjlivelyjr
    You mentioned in one of the other threads (http://www.sitepoint.com/forums/show...ht=persistence) having written an article on the subject. I am assuming the article doesn't mean that first thread. Do you have a link to the article? Does it go the same direction as your forum thread does ?
    The only public article I have written that remotely touches on this was using MockObjects to test code making use of a database. MockObjects are a truly wonderful invention, but I manage to choose the one example that was inappropriate . It was for PHP|Architect and I have a regular column there now, so maybe I can make amends on the subject.

    Quote Originally Posted by mjlivelyjr
    1. They frequently result in too much data being returned from the server which on a heavily utilized system could eat up bandwidth or cause unneccessary slow downs.
    This is a difficult one to solve in any general way. If you create partial data in the objects then you open a rats nest of double loads (two partial views overlapping) and object creation, say adding a collection member.

    That said, I doubt you would use a persistence layer with a very large dataset anyway. More likely you would have some kind of custom do'er to manipulate the data set.

    Quote Originally Posted by mjlivelyjr
    2. They also many times won't retrieve enough data in one query. I have as of yet to see a DAO that handles table joins, complicated grouping or 'where' clauses elegantly.
    What's typically missing?

    Quote Originally Posted by mjlivelyjr
    I suppose I could claim stupidity for not using the right search.
    Actually your question was sufficiently intelligent that I immediately added your blog RSS to my bookmarks .

    yours, Marcus
    Marcus Baker
    Testing: SimpleTest, Cgreen, Fakemail
    Other: Phemto dependency injector
    Books: PHP in Action, 97 things

  10. #10
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you don't have the book already, there is a sample chapter from Martin Fowler's book PoEAA called "Mapping to Relational Databases" at : http://www.aw.com/samplechapter/0321127420.pdf

    It doesn't deal that much with thoose complex issues, that you mention though. Still worth to read nevertheless.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •