<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: DO/DM Part2: LazyLoading, EmbeddedValue and some more&#8230;</title>
	<link>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/</link>
	<description>Mr Quinn, one word for your fans? "Ehm, astronaut."</description>
	<pubDate>Wed, 07 Jan 2009 04:30:07 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: Vance Lucas</title>
		<link>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-2335</link>
		<dc:creator>Vance Lucas</dc:creator>
		<pubDate>Tue, 30 Dec 2008 22:25:54 +0000</pubDate>
		<guid>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-2335</guid>
		<description>Found this article doing a search - you may want to check out a project of  mine that has already completed most of these nitty-gritty details.

http://phpdatamapper.com

You may find you like it, and it may be valuable to your visitors!</description>
		<content:encoded><![CDATA[<p>Found this article doing a search - you may want to check out a project of  mine that has already completed most of these nitty-gritty details.</p>
<p><a href="http://phpdatamapper.com" rel="nofollow">http://phpdatamapper.com</a></p>
<p>You may find you like it, and it may be valuable to your visitors!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maz</title>
		<link>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-392</link>
		<dc:creator>Maz</dc:creator>
		<pubDate>Sun, 01 Jun 2008 21:18:23 +0000</pubDate>
		<guid>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-392</guid>
		<description>Hi there. I love the blog post and this implementation of data mapper, which I intend to implement in my own application.

I have one question: If I was to include summary data, not necessarily objects but simple scalar values, like a post count in your application, where would the data access code for that reside? It doesn't seem to fit in the data mapper class itself, yet the data objects are meant to be database agnostic.

The best I can think at this time is a Posts and PostsMapper pair where Posts has some methods to get summary information like post counts for users etc but this seems messy.

Hope this is clear enough. Many thanks,
Maz</description>
		<content:encoded><![CDATA[<p>Hi there. I love the blog post and this implementation of data mapper, which I intend to implement in my own application.</p>
<p>I have one question: If I was to include summary data, not necessarily objects but simple scalar values, like a post count in your application, where would the data access code for that reside? It doesn&#8217;t seem to fit in the data mapper class itself, yet the data objects are meant to be database agnostic.</p>
<p>The best I can think at this time is a Posts and PostsMapper pair where Posts has some methods to get summary information like post counts for users etc but this seems messy.</p>
<p>Hope this is clear enough. Many thanks,<br />
Maz</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fredrik Holmström</title>
		<link>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-148</link>
		<dc:creator>Fredrik Holmström</dc:creator>
		<pubDate>Thu, 15 May 2008 14:14:09 +0000</pubDate>
		<guid>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-148</guid>
		<description>Sadly there are no good php books dealing with modern day design patterns, the closest you will get is "PHP Architect's Guide to PHP Design Patterns" and the "PHP In Action" books.

If you widen your search a bit you will come a cross a book called Patterns of Enterprise Application Architecture written by Martin Fowler, now this is a good book. All examples are in Java or C# however.</description>
		<content:encoded><![CDATA[<p>Sadly there are no good php books dealing with modern day design patterns, the closest you will get is &#8220;PHP Architect&#8217;s Guide to PHP Design Patterns&#8221; and the &#8220;PHP In Action&#8221; books.</p>
<p>If you widen your search a bit you will come a cross a book called Patterns of Enterprise Application Architecture written by Martin Fowler, now this is a good book. All examples are in Java or C# however.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: A</title>
		<link>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-50</link>
		<dc:creator>A</dc:creator>
		<pubDate>Sun, 27 Apr 2008 00:56:40 +0000</pubDate>
		<guid>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-50</guid>
		<description>Hi!

I know I asked before, but could you please suggest some good php books, have been developing in php4 for ages and it's finally time to take a step to a more object oriented programming (MVC-framework, patterns, etc). Could you please suggest some or point in the right direction? Thanks!

A fellow Swede.</description>
		<content:encoded><![CDATA[<p>Hi!</p>
<p>I know I asked before, but could you please suggest some good php books, have been developing in php4 for ages and it&#8217;s finally time to take a step to a more object oriented programming (MVC-framework, patterns, etc). Could you please suggest some or point in the right direction? Thanks!</p>
<p>A fellow Swede.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyle</title>
		<link>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-46</link>
		<dc:creator>Kyle</dc:creator>
		<pubDate>Tue, 15 Apr 2008 08:16:53 +0000</pubDate>
		<guid>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-46</guid>
		<description>I was a bit surprised by 2) and even more when I found the same behavior in Java and C++ - that was new to me and I still find it strange. It a world of surprises ;)

See you on part 3, Kyle</description>
		<content:encoded><![CDATA[<p>I was a bit surprised by 2) and even more when I found the same behavior in Java and C++ - that was new to me and I still find it strange. It a world of surprises ;)</p>
<p>See you on part 3, Kyle</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fredrik Holmström</title>
		<link>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-45</link>
		<dc:creator>Fredrik Holmström</dc:creator>
		<pubDate>Mon, 14 Apr 2008 21:30:37 +0000</pubDate>
		<guid>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-45</guid>
		<description>Hi Kyle,

Thanks for your comment :), here's my thoughts on your two points:

1) This is a matter of ideology I think, if you should be able to effect a row in the database without loading it first. I don't think you should, and such an update "action" would require you to first load the object and then save it with the modified field. Well, it's also a matter of performance.

2) Well, the $map attribute is defined in DataMapper which is the parent class to both UserMapper and PostMapper and thus they can access it (as far as I know this is all according to what people refer to as a proper object model) however if I would've defined an attribute just in UserMapper and protected it then no, PostMapper would not be able to access it.</description>
		<content:encoded><![CDATA[<p>Hi Kyle,</p>
<p>Thanks for your comment :), here&#8217;s my thoughts on your two points:</p>
<p>1) This is a matter of ideology I think, if you should be able to effect a row in the database without loading it first. I don&#8217;t think you should, and such an update &#8220;action&#8221; would require you to first load the object and then save it with the modified field. Well, it&#8217;s also a matter of performance.</p>
<p>2) Well, the $map attribute is defined in DataMapper which is the parent class to both UserMapper and PostMapper and thus they can access it (as far as I know this is all according to what people refer to as a proper object model) however if I would&#8217;ve defined an attribute just in UserMapper and protected it then no, PostMapper would not be able to access it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyle</title>
		<link>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-44</link>
		<dc:creator>Kyle</dc:creator>
		<pubDate>Mon, 14 Apr 2008 13:45:55 +0000</pubDate>
		<guid>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-44</guid>
		<description>Hi Fredrik,

once again: Two thumbs up! I'm eager to see your doctoral thesis ;)

Two small things:

1.) Once again your code should not depend on the way it is used. Your implementation of save() assumes, that existing objects are loaded (and stored in the IdentityMap) before they are saved/updated. If you have an update page for user object and a user changed his name you get a new user if you don't load it first.

Bad code:
...
$user = new User( $_POST['ID'], $_POST['NAME'] );
$userMapper-&#62;save( $user ); // new user created!
...

So DataMapper::save() might better use "if( $obj-&#62;getId() !== null &#38;&#38; $this-&#62;find( $obj-&#62;getId ) )" to check if an object is existing.

2.) I'm not sure if it works in PHP, it shouldn't anyway: Accessing the UserMappers "map" in PostMapper should not work, since it is a protected variable in a different class's instance. 

Regards, Kyle</description>
		<content:encoded><![CDATA[<p>Hi Fredrik,</p>
<p>once again: Two thumbs up! I&#8217;m eager to see your doctoral thesis ;)</p>
<p>Two small things:</p>
<p>1.) Once again your code should not depend on the way it is used. Your implementation of save() assumes, that existing objects are loaded (and stored in the IdentityMap) before they are saved/updated. If you have an update page for user object and a user changed his name you get a new user if you don&#8217;t load it first.</p>
<p>Bad code:<br />
&#8230;<br />
$user = new User( $_POST[&#8217;ID&#8217;], $_POST[&#8217;NAME&#8217;] );<br />
$userMapper-&gt;save( $user ); // new user created!<br />
&#8230;</p>
<p>So DataMapper::save() might better use &#8220;if( $obj-&gt;getId() !== null &amp;&amp; $this-&gt;find( $obj-&gt;getId ) )&#8221; to check if an object is existing.</p>
<p>2.) I&#8217;m not sure if it works in PHP, it shouldn&#8217;t anyway: Accessing the UserMappers &#8220;map&#8221; in PostMapper should not work, since it is a protected variable in a different class&#8217;s instance. </p>
<p>Regards, Kyle</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jandi</title>
		<link>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-40</link>
		<dc:creator>jandi</dc:creator>
		<pubDate>Fri, 11 Apr 2008 21:52:45 +0000</pubDate>
		<guid>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-40</guid>
		<description>är det fel på mig för jag inte fattar ett piss?
skriv dikter istället!!!</description>
		<content:encoded><![CDATA[<p>är det fel på mig för jag inte fattar ett piss?<br />
skriv dikter istället!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Love and Theft &#187; DomainObject and DataMappers</title>
		<link>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-39</link>
		<dc:creator>Love and Theft &#187; DomainObject and DataMappers</dc:creator>
		<pubDate>Fri, 11 Apr 2008 15:42:37 +0000</pubDate>
		<guid>http://loveandtheft.org/2008/04/11/dodm-part2-lazyloading-embeddedvalue-and-some-more/#comment-39</guid>
		<description>[...] Update: Part2 Now Available [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Update: Part2 Now Available [&#8230;]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
