×
  • Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
 

Play-Doh: Modelling Your Objects

by Project Lead, Zend Framework at Zend Technologies, Ltd. on May 26, 2009

  • 10,533 views

Short un-conference tutorial showing how to create your models in a way that is data layer independent, testable, and extensible.

Short un-conference tutorial showing how to create your models in a way that is data layer independent, testable, and extensible.

Statistics

Views

Total Views
10,533
Views on SlideShare
10,502
Embed Views
31

Actions

Likes
9
Downloads
103
Comments
3

4 Embeds 31

http://www.slideshare.net 24
http://www.linkedin.com 3
http://www.php-talks.com 3
http://translate.googleusercontent.com 1

Accessibility

Categories

Upload Details

Uploaded via SlideShare as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

13 of 3 previous next Post a comment

  • pleasebugmenot pleasebugmenot, leecher at away Thanks for your quick answer.
    I got your point about the save() method.
    I think i was wrong while thinking about this, and as you say, the object which saves, also does the instrospection to know what to do, but i thought differently while asking the question.
    I read some of your article on your blog covering a similar approach and it was quite interesting.
    The introducing of a Mapper & a Service which could be decorated is a quite interesting point.
    I would be happy if you have some documents/links about relational mapping.
    Thanks again for your works
    4 years ago
    Are you sure you want to
    Your message goes here
    Processing…
  • weierophinney Matthew Weier O'Phinney, Project Lead, Zend Framework at Zend Technologies, Ltd. Relational mapping is very difficult, and was way beyond the scope of this presentation. The primary purpose of the presentation was to get PHP developers to start thinking beyond the RDBMS and instead focus on the objects they're manipulating. I mention ORMs briefly within this presentation as they can be used to solve some of the problems of persisting your models (though since ORMs are typically RDBMS-specific, they do not answer the question of persisting through document databases or web services) -- but there was no time to go into detail on that subject.

    As for save() vs. insert()/update(), save() is used in many ORMs, ActiveRecord, and Table Data Gateway implementations because it simplifies the interface. You do not need to know how the object was instantiated -- i.e., was it loaded from the persistence store, or is it a newly created object -- you simply save() it. save() then does the introspection of the object for you and decides if it is an update() or insert() operation -- and when done, updates the object from the persistence store.
    4 years ago
    Are you sure you want to
    Your message goes here
    Processing…
  • pleasebugmenot pleasebugmenot, leecher at away Insteresting slide, but it covers only simple cases.
    What would have been insteresting is to cover classic problems like relational tables mapping.
    For example, how do you handle a Post domain object and a User domain object.
    Do you write a new PostUser object ? do you include userId, or userObject within the Post object ?

    Another point is, if i save i need to know if i update, or i insert, which is often simple to know for me because, if the userId is present in the object, i know the object has been retrieved from the DB, and then need to be updated, not inserted.
    Then, it is insteresting to return the new User object with its userId, but it could break the pattern.
    What do you think about this ?
    4 years ago
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Play-Doh: Modelling Your Objects Play-Doh: Modelling Your Objects Presentation Transcript