<?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"
	>
<channel>
	<title>Comments on: Fat Models and the Data Access Layer</title>
	<atom:link href="http://www.davedevelopment.co.uk/2008/06/17/fat-models-and-the-data-access-layer/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davedevelopment.co.uk/2008/06/17/fat-models-and-the-data-access-layer/</link>
	<description>Dave Marshall</description>
	<pubDate>Thu, 20 Nov 2008 12:52:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>By: Nick Lo</title>
		<link>http://www.davedevelopment.co.uk/2008/06/17/fat-models-and-the-data-access-layer/#comment-56254</link>
		<dc:creator>Nick Lo</dc:creator>
		<pubDate>Mon, 23 Jun 2008 12:43:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.davedevelopment.co.uk/?p=66#comment-56254</guid>
		<description>Hi Dave,

Aside from what seems to be questioning a gut feeling, you don't really specify any particular issue with what you're doing so maybe what you're after is some additional justification...

First you could mention the added flavour that a row class would bring to this mix:

// in your table class
protected $_name = 'persons'; 
protected $_rowClass = 'Persons_Row';

class Content_Row extends Zend_Db_Table_Row_Abstract implements Some_Cool_Class
{
    protected function _insert()
    {
    	if(is_null($this-&#62;date_created)) {
    		$this-&#62;date_created = date('Y-m-d H:i:s');
        }
    }
}

Then that your persons class is now freer to subclass something like say an observer pattern class:

class Persons extends Something implements Something_Else ...

Finally (since it's too late for anything else to spring to mind rather than this being a grand reason) I'll wave my hand and say I've been taking this approach. I've not however had the form tied so tightly though I do like the idea.

Fat Model, skinny controller in a flexible more easily testable package; looks good.</description>
		<content:encoded><![CDATA[<p>Hi Dave,</p>
<p>Aside from what seems to be questioning a gut feeling, you don&#8217;t really specify any particular issue with what you&#8217;re doing so maybe what you&#8217;re after is some additional justification&#8230;</p>
<p>First you could mention the added flavour that a row class would bring to this mix:</p>
<p>// in your table class<br />
protected $_name = &#8216;persons&#8217;;<br />
protected $_rowClass = &#8216;Persons_Row&#8217;;</p>
<p>class Content_Row extends Zend_Db_Table_Row_Abstract implements Some_Cool_Class<br />
{<br />
    protected function _insert()<br />
    {<br />
    	if(is_null($this-&gt;date_created)) {<br />
    		$this-&gt;date_created = date(&#8217;Y-m-d H:i:s&#8217;);<br />
        }<br />
    }<br />
}</p>
<p>Then that your persons class is now freer to subclass something like say an observer pattern class:</p>
<p>class Persons extends Something implements Something_Else &#8230;</p>
<p>Finally (since it&#8217;s too late for anything else to spring to mind rather than this being a grand reason) I&#8217;ll wave my hand and say I&#8217;ve been taking this approach. I&#8217;ve not however had the form tied so tightly though I do like the idea.</p>
<p>Fat Model, skinny controller in a flexible more easily testable package; looks good.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.davedevelopment.co.uk/2008/06/17/fat-models-and-the-data-access-layer/#comment-56248</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Mon, 23 Jun 2008 11:34:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.davedevelopment.co.uk/?p=66#comment-56248</guid>
		<description>If you guys come to implement some more on this "new/divided" Model, please publish it here. I'm very curious about this ideas.

I think it's hard to foreseen if a class will be reusable or not, I'm mean, will be "need" in another process or not, so I always try to loose the coupling the most I can.

So to me, having this new layer is very cheap and worths the price, always. It's cleaner and gives back to Model it's actual role, that is take care of the logic, the "information", and let the TableGateway take care of the "data".</description>
		<content:encoded><![CDATA[<p>If you guys come to implement some more on this &#8220;new/divided&#8221; Model, please publish it here. I&#8217;m very curious about this ideas.</p>
<p>I think it&#8217;s hard to foreseen if a class will be reusable or not, I&#8217;m mean, will be &#8220;need&#8221; in another process or not, so I always try to loose the coupling the most I can.</p>
<p>So to me, having this new layer is very cheap and worths the price, always. It&#8217;s cleaner and gives back to Model it&#8217;s actual role, that is take care of the logic, the &#8220;information&#8221;, and let the TableGateway take care of the &#8220;data&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J. Pluijmers</title>
		<link>http://www.davedevelopment.co.uk/2008/06/17/fat-models-and-the-data-access-layer/#comment-56228</link>
		<dc:creator>J. Pluijmers</dc:creator>
		<pubDate>Mon, 23 Jun 2008 08:31:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.davedevelopment.co.uk/?p=66#comment-56228</guid>
		<description>There isn't really common practise for this. In cases like this I ask myself:

1. How reusable is this package iam creating? Is abstracting it really worth the effort and if iam going to absctract how abstract would it need to be to be reusable?

2. Enviorment, in the context of your example its realy the duty of the controller to couple both models together. Hence all the methods described in the linked article Dependency Injection can be applied. But wich solution all depends on rule 1.</description>
		<content:encoded><![CDATA[<p>There isn&#8217;t really common practise for this. In cases like this I ask myself:</p>
<p>1. How reusable is this package iam creating? Is abstracting it really worth the effort and if iam going to absctract how abstract would it need to be to be reusable?</p>
<p>2. Enviorment, in the context of your example its realy the duty of the controller to couple both models together. Hence all the methods described in the linked article Dependency Injection can be applied. But wich solution all depends on rule 1.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: daveyboy</title>
		<link>http://www.davedevelopment.co.uk/2008/06/17/fat-models-and-the-data-access-layer/#comment-55908</link>
		<dc:creator>daveyboy</dc:creator>
		<pubDate>Sat, 21 Jun 2008 09:49:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.davedevelopment.co.uk/?p=66#comment-55908</guid>
		<description>Thanks demon, an abstract Model class could definitely provide the basic getForm and getTable methods, would save implementing them repeatedly, seeing as we'd probably want to do Organisation::getTable() from the Person Model for example.

I had a quick look at &lt;a href="http://www.google.com/url?sa=t&#038;ct=res&#038;cd=2&#038;url=http%3A%2F%2Fframework.zend.com%2Fwiki%2Fdisplay%2FZFPROP%2FZend_Di%2B-%2BFederico%2BCargnelutti&#038;ei=OM5cSLH2GZyUQpnE7Z4E&#038;usg=AFQjCNHGQMeufBzx4BTN9A583SOiWAv4fg&#038;sig2=4S7YSa_pxrLY_ZtwY4K_wQ" rel="nofollow"&gt;Zend_Di&lt;/a&gt;, which looks like a nice simple solution to the Dependency Injection.

I wouldn't hold your breath for more comments, this blogs not popular enough ;)</description>
		<content:encoded><![CDATA[<p>Thanks demon, an abstract Model class could definitely provide the basic getForm and getTable methods, would save implementing them repeatedly, seeing as we&#8217;d probably want to do Organisation::getTable() from the Person Model for example.</p>
<p>I had a quick look at <a href="http://www.google.com/url?sa=t&#038;ct=res&#038;cd=2&#038;url=http%3A%2F%2Fframework.zend.com%2Fwiki%2Fdisplay%2FZFPROP%2FZend_Di%2B-%2BFederico%2BCargnelutti&#038;ei=OM5cSLH2GZyUQpnE7Z4E&#038;usg=AFQjCNHGQMeufBzx4BTN9A583SOiWAv4fg&#038;sig2=4S7YSa_pxrLY_ZtwY4K_wQ" rel="nofollow">Zend_Di</a>, which looks like a nice simple solution to the Dependency Injection.</p>
<p>I wouldn&#8217;t hold your breath for more comments, this blogs not popular enough ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: demonburrito</title>
		<link>http://www.davedevelopment.co.uk/2008/06/17/fat-models-and-the-data-access-layer/#comment-55882</link>
		<dc:creator>demonburrito</dc:creator>
		<pubDate>Sat, 21 Jun 2008 06:34:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.davedevelopment.co.uk/?p=66#comment-55882</guid>
		<description>I think you're on the right track with this approach. I've been trying to make models fatter with ZF recently, but it had not occurred to me to consider Zend_Form to be part of the model. I like it a lot.

It seems there are a whole bunch of alternative implementations available to you, though. Persons could extend an abstract class with default definitions of getTable and getForm, instead of being static methods of Persons. That abstract class could use the same kind of path magic that Zend_Loader uses, or you could just stick to your filename convention; using the __CLASS__ magic constant for the directory name.

That's just off the top of my head... I don't know if this fits smoothly in to your TDD routine. My head always hurts after reading Fowler (always worth it, though).

Can't wait to see more comments on this. Good post.</description>
		<content:encoded><![CDATA[<p>I think you&#8217;re on the right track with this approach. I&#8217;ve been trying to make models fatter with ZF recently, but it had not occurred to me to consider Zend_Form to be part of the model. I like it a lot.</p>
<p>It seems there are a whole bunch of alternative implementations available to you, though. Persons could extend an abstract class with default definitions of getTable and getForm, instead of being static methods of Persons. That abstract class could use the same kind of path magic that Zend_Loader uses, or you could just stick to your filename convention; using the __CLASS__ magic constant for the directory name.</p>
<p>That&#8217;s just off the top of my head&#8230; I don&#8217;t know if this fits smoothly in to your TDD routine. My head always hurts after reading Fowler (always worth it, though).</p>
<p>Can&#8217;t wait to see more comments on this. Good post.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
