SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Jan 2007
    Posts
    323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Datamapper / Domain Object basic examples

    Where can I find some basic examples of these two design patterns?
    Datamapper / Domain Object

    I want to avoid ActiveRecord but am having a hard time differentiating it from Domain Object.

    Some examples or skeleton/outlines of the classes would help.

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

    I take it you've read the Martin Fowler book (Patterns of Enterprise Application Architecture)?

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

  3. #3
    SitePoint Zealot
    Join Date
    Feb 2009
    Location
    Bristol
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Objects, Patterns and Practice:
    http://apress.com/book/view/9781430229254

    Data Access Patterns: Database Interactions in Object-Oriented Applications
    http://www.amazon.co.uk/Data-Access-...2365565&sr=8-2

  4. #4
    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)
    Quote Originally Posted by atDev View Post
    I want to avoid ActiveRecord but am having a hard time differentiating it from Domain Object.
    Active Record is a way to create an object oriented domain model. Data mapper is another way.

  5. #5
    SitePoint Zealot
    Join Date
    Feb 2009
    Location
    Bristol
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    in a nutshell

    Active Record represents a one to one relationship between an object and a table on a database,

    Data Mapper on the other hand can map several tables to one object (and back again).

  6. #6
    SitePoint Member romanb's Avatar
    Join Date
    May 2006
    Location
    Berlin
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kyberfabrikken View Post
    Active Record is a way to create an object oriented domain model. Data mapper is another way.
    I'm pretty sure you mean it that way but that should rather be:

    "ActiveRecord is a way to persist an object oriented domain model. Data mapper is another way."

    I think the difference is crucial
    Math is right or wrong, software is just broken.

  7. #7
    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)
    Quote Originally Posted by romanb View Post
    "ActiveRecord is a way to persist an object oriented domain model. Data mapper is another way."
    Sort of. What I meant was that it's a particular way of implementing it. The problem with AR is that it couples persistence and domain model to each other.


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
  •