<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Lingering reservations about ORM</title>
	<atom:link href="http://dorkage.net/blog/2009/12/03/lingering-reservations-about-orm/feed/" rel="self" type="application/rss+xml" />
	<link>http://dorkage.net/blog/2009/12/03/lingering-reservations-about-orm/</link>
	<description>überblog geek life, humour, insights, and meta stuff</description>
	<lastBuildDate>Thu, 31 Mar 2011 15:54:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
	<atom:link rel="hub" href="http://superfeedr.com/hubbub" />
		<item>
		<title>By: Agence de mode Paris</title>
		<link>http://dorkage.net/blog/2009/12/03/lingering-reservations-about-orm/comment-page-1/#comment-2664</link>
		<dc:creator>Agence de mode Paris</dc:creator>
		<pubDate>Sat, 11 Dec 2010 05:51:23 +0000</pubDate>
		<guid isPermaLink="false">http://dorkage.net/?p=994#comment-2664</guid>
		<description>Your information about ORM.. is nice. I think that&#039;s a great collection and defined in well manner. Thanks for posting.</description>
		<content:encoded><![CDATA[<p>Your information about ORM.. is nice. I think that&#8217;s a great collection and defined in well manner. Thanks for posting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carpet cleaning Virginia Beach</title>
		<link>http://dorkage.net/blog/2009/12/03/lingering-reservations-about-orm/comment-page-1/#comment-1929</link>
		<dc:creator>carpet cleaning Virginia Beach</dc:creator>
		<pubDate>Wed, 06 Jan 2010 15:05:36 +0000</pubDate>
		<guid isPermaLink="false">http://dorkage.net/?p=994#comment-1929</guid>
		<description>thanks for the information on ORM... keep posting.</description>
		<content:encoded><![CDATA[<p>thanks for the information on ORM&#8230; keep posting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://dorkage.net/blog/2009/12/03/lingering-reservations-about-orm/comment-page-1/#comment-1784</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Fri, 04 Dec 2009 11:10:10 +0000</pubDate>
		<guid isPermaLink="false">http://dorkage.net/?p=994#comment-1784</guid>
		<description>What you&#039;re saying is more typified by the &quot;bad code.&quot;  I get this user object and I also want some related stuff.  I told it that and it gave me what I wanted but it decided to do it a really dumb way.  

To be sure, the &quot;good&quot; code does look more like a SWL query.

I don&#039;t think that ORMs should totally break away from SQL, at least not until we can have both clarity and decent performance from &quot;telling it what you want.&quot; and that presents another layer of communication.  I can tell it what I want very eloquently with a high performing SQL query.  Now I have to learn a whole bunch of new methods just to do what I can already do.  

The ORM would have to be doing some kind of analysis of the code that is callig it to figure out that it need to join a bunch of stuff and then iterate through the results!</description>
		<content:encoded><![CDATA[<p>What you&#8217;re saying is more typified by the &#8220;bad code.&#8221;  I get this user object and I also want some related stuff.  I told it that and it gave me what I wanted but it decided to do it a really dumb way.  </p>
<p>To be sure, the &#8220;good&#8221; code does look more like a SWL query.</p>
<p>I don&#8217;t think that ORMs should totally break away from SQL, at least not until we can have both clarity and decent performance from &#8220;telling it what you want.&#8221; and that presents another layer of communication.  I can tell it what I want very eloquently with a high performing SQL query.  Now I have to learn a whole bunch of new methods just to do what I can already do.  </p>
<p>The ORM would have to be doing some kind of analysis of the code that is callig it to figure out that it need to join a bunch of stuff and then iterate through the results!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mary Nicole Hicks</title>
		<link>http://dorkage.net/blog/2009/12/03/lingering-reservations-about-orm/comment-page-1/#comment-1781</link>
		<dc:creator>Mary Nicole Hicks</dc:creator>
		<pubDate>Fri, 04 Dec 2009 03:58:37 +0000</pubDate>
		<guid isPermaLink="false">http://dorkage.net/?p=994#comment-1781</guid>
		<description>The problem with your good code is that you are using your ORM in more of a relational manner than Object Orientated. It looks like you just wrote a glorified SQL query.

I think ORMs still have not broken away from SQL enough. You should be telling the ORM what you want and it should decide to do the join.

I think a ORM call should be structure like this:
$user-&gt;comments()-&gt;NewsItems()-&gt;Rows

$user-&gt;comments() should not return a comment, but a ORM object. Internally the $user-&gt;comment() object should simple record &quot;join user and comment tables where x&quot;.

$user-&gt;comments()-&gt;NewsItems() should not return a NewsItem, but a ORM object. Internally the $user-&gt;comments()-&gt;NewsItems() object should simple record &quot;join user, comment and newsitem tables where x and x&quot;.

When $user-&gt;comments()-&gt;NewsItems()-&gt;Rows property is called it should then be able to join all required tables and only require 1 SQL query.

In your example it would do this:
$user = Core::getTable(&#039;User&#039;)-&gt;find(1);
foreach ($user-&gt;Comments()-&gt;Rows as $comment)
{
   print $comment-&gt;NewsItems()-&gt;Row-&gt;title . &#039;&#039;;
}

Only when Rows/Row is called would the ORM run sql Query. Until then you whould only be dealing wirh ORM objects.</description>
		<content:encoded><![CDATA[<p>The problem with your good code is that you are using your ORM in more of a relational manner than Object Orientated. It looks like you just wrote a glorified SQL query.</p>
<p>I think ORMs still have not broken away from SQL enough. You should be telling the ORM what you want and it should decide to do the join.</p>
<p>I think a ORM call should be structure like this:<br />
$user-&gt;comments()-&gt;NewsItems()-&gt;Rows</p>
<p>$user-&gt;comments() should not return a comment, but a ORM object. Internally the $user-&gt;comment() object should simple record &#8220;join user and comment tables where x&#8221;.</p>
<p>$user-&gt;comments()-&gt;NewsItems() should not return a NewsItem, but a ORM object. Internally the $user-&gt;comments()-&gt;NewsItems() object should simple record &#8220;join user, comment and newsitem tables where x and x&#8221;.</p>
<p>When $user-&gt;comments()-&gt;NewsItems()-&gt;Rows property is called it should then be able to join all required tables and only require 1 SQL query.</p>
<p>In your example it would do this:<br />
$user = Core::getTable(&#8216;User&#8217;)-&gt;find(1);<br />
foreach ($user-&gt;Comments()-&gt;Rows as $comment)<br />
{<br />
   print $comment-&gt;NewsItems()-&gt;Row-&gt;title . &#8221;;<br />
}</p>
<p>Only when Rows/Row is called would the ORM run sql Query. Until then you whould only be dealing wirh ORM objects.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://dorkage.net/blog/2009/12/03/lingering-reservations-about-orm/comment-page-1/#comment-1778</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 03 Dec 2009 20:13:26 +0000</pubDate>
		<guid isPermaLink="false">http://dorkage.net/?p=994#comment-1778</guid>
		<description>Sorry about the typos, I just copied the example verbatim late at night without setting it up first because it brought the principal issue into such sharp focus.  Will fix shortly.  And I totally understand about making it database agnostic having to make a few sacrifices.    Now you are making me itch to try V 2.0.  My results were all based on 1.2

Truly Doctrine is the first one I&#039;ve seen that exposes enough granularity without losing the X-plat abstraction so that I believe I could work with it.  :)  (and in a really rare critical situation I could write a non portable optimal query and just document it really really hard!)  Keep up the good work!</description>
		<content:encoded><![CDATA[<p>Sorry about the typos, I just copied the example verbatim late at night without setting it up first because it brought the principal issue into such sharp focus.  Will fix shortly.  And I totally understand about making it database agnostic having to make a few sacrifices.    Now you are making me itch to try V 2.0.  My results were all based on 1.2</p>
<p>Truly Doctrine is the first one I&#8217;ve seen that exposes enough granularity without losing the X-plat abstraction so that I believe I could work with it.  <img src='http://dorkage.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   (and in a really rare critical situation I could write a non portable optimal query and just document it really really hard!)  Keep up the good work!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ubieranki</title>
		<link>http://dorkage.net/blog/2009/12/03/lingering-reservations-about-orm/comment-page-1/#comment-1777</link>
		<dc:creator>ubieranki</dc:creator>
		<pubDate>Thu, 03 Dec 2009 17:59:09 +0000</pubDate>
		<guid isPermaLink="false">http://dorkage.net/?p=994#comment-1777</guid>
		<description>Thispost is really interesting, I didn&#039;t know all of this.</description>
		<content:encoded><![CDATA[<p>Thispost is really interesting, I didn&#8217;t know all of this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guilherme Blanco</title>
		<link>http://dorkage.net/blog/2009/12/03/lingering-reservations-about-orm/comment-page-1/#comment-1776</link>
		<dc:creator>Guilherme Blanco</dc:creator>
		<pubDate>Thu, 03 Dec 2009 13:31:33 +0000</pubDate>
		<guid isPermaLink="false">http://dorkage.net/?p=994#comment-1776</guid>
		<description>Hi, I am one of the core developers of Doctrine.

First of all, the &quot;good code&quot; misses a &quot;C.&quot; before &quot;NewsItem N&quot;. This is a requirement because it must know which relation it&#039;s going to be considered. It&#039;s not a top-level component.

I think everybody agrees that any ORM can bloat an application if used incorrectly. By taking advantage of an OQL (DQL is a proprietary OQL), auto load of relations are possible.
Of course we may suggest to not load the entire relations tree also, you must know what you&#039;re doing.

Doctrine 1.X series is a bit bloated since it grouped LOTS of functionality. But I&#039;d suggest you to take a look at Doctrine 2, which is a very well engineered solution based in JPAv2 (JSR-317) spec.

We internally apply lots of optimizations, but nothing better than a DBA allied in the project to point to exact places. That&#039;s why we also provide a DBAL layer, allowing DBAs to play with the schema, including add indexes, constraints, checks, etc.
But you have to be aware that we need to have some guidance, and we always focus on most generic way. So an specific query may not be the optimal one for a given platform, but it works in all of them.

Keep compatibility with Oracle, MySQL, PgSQL, SQLite, SQL Server... arf... it&#039;s not an easy task! =)

Anyway, good to see that we got some attention from DBAs also!

Cheers,

Guilherme Blanco</description>
		<content:encoded><![CDATA[<p>Hi, I am one of the core developers of Doctrine.</p>
<p>First of all, the &#8220;good code&#8221; misses a &#8220;C.&#8221; before &#8220;NewsItem N&#8221;. This is a requirement because it must know which relation it&#8217;s going to be considered. It&#8217;s not a top-level component.</p>
<p>I think everybody agrees that any ORM can bloat an application if used incorrectly. By taking advantage of an OQL (DQL is a proprietary OQL), auto load of relations are possible.<br />
Of course we may suggest to not load the entire relations tree also, you must know what you&#8217;re doing.</p>
<p>Doctrine 1.X series is a bit bloated since it grouped LOTS of functionality. But I&#8217;d suggest you to take a look at Doctrine 2, which is a very well engineered solution based in JPAv2 (JSR-317) spec.</p>
<p>We internally apply lots of optimizations, but nothing better than a DBA allied in the project to point to exact places. That&#8217;s why we also provide a DBAL layer, allowing DBAs to play with the schema, including add indexes, constraints, checks, etc.<br />
But you have to be aware that we need to have some guidance, and we always focus on most generic way. So an specific query may not be the optimal one for a given platform, but it works in all of them.</p>
<p>Keep compatibility with Oracle, MySQL, PgSQL, SQLite, SQL Server&#8230; arf&#8230; it&#8217;s not an easy task! =)</p>
<p>Anyway, good to see that we got some attention from DBAs also!</p>
<p>Cheers,</p>
<p>Guilherme Blanco</p>
]]></content:encoded>
	</item>
</channel>
</rss>

