<?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: Thinking about the model</title>
	<atom:link href="http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/feed/" rel="self" type="application/rss+xml" />
	<link>http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/</link>
	<description>baking cakes with CakePHP</description>
	<lastBuildDate>Wed, 28 Jul 2010 19:06:52 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Thinking about the model II - cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/comment-page-1/#comment-84314</link>
		<dc:creator>Thinking about the model II - cakebaker</dc:creator>
		<pubDate>Tue, 22 Apr 2008 17:11:07 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/#comment-84314</guid>
		<description>[...] while ago I wrote an article Thinking about the model in which I shared some ideas about how CakePHP&#8217;s Model class could be improved. In this [...]</description>
		<content:encoded><![CDATA[<p>[...] while ago I wrote an article Thinking about the model in which I shared some ideas about how CakePHP&#8217;s Model class could be improved. In this [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/comment-page-1/#comment-62012</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Sat, 02 Feb 2008 08:35:42 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/#comment-62012</guid>
		<description>@speedmax: Ah, I overlooked that your solution uses DataObjects :&#124;  But it makes sense to use such a special data container object instead of the model.</description>
		<content:encoded><![CDATA[<p>@speedmax: Ah, I overlooked that your solution uses DataObjects :|  But it makes sense to use such a special data container object instead of the model.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: speedmax</title>
		<link>http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/comment-page-1/#comment-61534</link>
		<dc:creator>speedmax</dc:creator>
		<pubDate>Fri, 01 Feb 2008 01:30:51 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/#comment-61534</guid>
		<description>@cakebaker - What i was doing was a experiment after all. Its a very blur line in MVC architecture, for instance, Model represents data along with its data structure and business logic. 

sorry I didn&#039;t clarify it, It is not passing raw Model instance back, instead its passing a instance of custom data container &quot;DataObject&quot; class, which happens to have hidden reference to respective Model.. 

for the &quot;abuse&quot; issue. 
You have to explicitly define and allows which Model methods is a callable in the object instance(DataObject Class) http://bin.cakephp.org/saved/25937 scroll down to see the implementation of DataObject class, 
Its very similar to attr_reader in ruby, unless you have define them, methods are all private, (make it pretty hard to abuse, since abuse type coder are lazy)


for instance, Person::is_healthy() method hide underlying detail of person&#039;s health record, but perform logic according to his (medical record, current health status) to determine and return a boolean. its a prefect example of leaving these logic inside model, (can be calculated inside controller, what happen if there are many of those, you see? i am trying to do something different)

Then the person object is very useful in view.


{% if not person.is_healthy %}
  dude you have a problem 
{% endif %}


PS: the syntax is H2O template engine i authored. a whole shebang of django port but compiles down to native php, very fast. if you interested. svn.idealian.net/h2o/branch/0.2</description>
		<content:encoded><![CDATA[<p>@cakebaker &#8211; What i was doing was a experiment after all. Its a very blur line in MVC architecture, for instance, Model represents data along with its data structure and business logic. </p>
<p>sorry I didn&#8217;t clarify it, It is not passing raw Model instance back, instead its passing a instance of custom data container &#8220;DataObject&#8221; class, which happens to have hidden reference to respective Model.. </p>
<p>for the &#8220;abuse&#8221; issue.<br />
You have to explicitly define and allows which Model methods is a callable in the object instance(DataObject Class) <a href="http://bin.cakephp.org/saved/25937" rel="nofollow">http://bin.cakephp.org/saved/25937</a> scroll down to see the implementation of DataObject class,<br />
Its very similar to attr_reader in ruby, unless you have define them, methods are all private, (make it pretty hard to abuse, since abuse type coder are lazy)</p>
<p>for instance, Person::is_healthy() method hide underlying detail of person&#8217;s health record, but perform logic according to his (medical record, current health status) to determine and return a boolean. its a prefect example of leaving these logic inside model, (can be calculated inside controller, what happen if there are many of those, you see? i am trying to do something different)</p>
<p>Then the person object is very useful in view.</p>
<p>{% if not person.is_healthy %}<br />
  dude you have a problem<br />
{% endif %}</p>
<p>PS: the syntax is H2O template engine i authored. a whole shebang of django port but compiles down to native php, very fast. if you interested. svn.idealian.net/h2o/branch/0.2</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/comment-page-1/#comment-60791</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Tue, 29 Jan 2008 15:10:01 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/#comment-60791</guid>
		<description>@RainChen: Thanks for the link!</description>
		<content:encoded><![CDATA[<p>@RainChen: Thanks for the link!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RainChen</title>
		<link>http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/comment-page-1/#comment-60119</link>
		<dc:creator>RainChen</dc:creator>
		<pubDate>Sat, 26 Jan 2008 17:58:45 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/#comment-60119</guid>
		<description>oh guys. I think you should think about this question much more earlier. I strongly recommend you to check out this espisode about how Rails expert suggests to do:
http://railscasts.com/episodes/4</description>
		<content:encoded><![CDATA[<p>oh guys. I think you should think about this question much more earlier. I strongly recommend you to check out this espisode about how Rails expert suggests to do:<br />
<a href="http://railscasts.com/episodes/4" rel="nofollow">http://railscasts.com/episodes/4</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/comment-page-1/#comment-59604</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Thu, 24 Jan 2008 17:59:13 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/#comment-59604</guid>
		<description>@speedmax: Thanks for the links, they look interesting. I think the challenge with passing models to the views is to not &quot;abuse&quot; them. Should you do something like get_related_pages() in the view or in the controller?</description>
		<content:encoded><![CDATA[<p>@speedmax: Thanks for the links, they look interesting. I think the challenge with passing models to the views is to not &#8220;abuse&#8221; them. Should you do something like get_related_pages() in the view or in the controller?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: speedmax</title>
		<link>http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/comment-page-1/#comment-58112</link>
		<dc:creator>speedmax</dc:creator>
		<pubDate>Sat, 19 Jan 2008 14:35:15 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/#comment-58112</guid>
		<description>@cakebaker - i implemented ObjectizeBehavior specifically for that. I started working as a wacky experiment to create a data access api since object instance allows better encapsulation and access control. 

My goal is to pass this object straight to Views (in my case templates) 
the goal is so following is possible in my templates 
page is a object instance returned by Page model,
{{ page.title &#124; capitalize }}
or even
{{ page.get_related_pages.first.title }}

where get_related_pages is a method in Page model return list of page objects, print out first item&#039;s title. (yes that was django syntax in php)


there is my very rough post about the details ObjectizeBehavior, sorry for poor writing but interesting stuff
http://idealian.net/?p=3

gwoo has a simpler approach 
http://bin.cakephp.org/saved/1237</description>
		<content:encoded><![CDATA[<p>@cakebaker &#8211; i implemented ObjectizeBehavior specifically for that. I started working as a wacky experiment to create a data access api since object instance allows better encapsulation and access control. </p>
<p>My goal is to pass this object straight to Views (in my case templates)<br />
the goal is so following is possible in my templates<br />
page is a object instance returned by Page model,<br />
{{ page.title | capitalize }}<br />
or even<br />
{{ page.get_related_pages.first.title }}</p>
<p>where get_related_pages is a method in Page model return list of page objects, print out first item&#8217;s title. (yes that was django syntax in php)</p>
<p>there is my very rough post about the details ObjectizeBehavior, sorry for poor writing but interesting stuff<br />
<a href="http://idealian.net/?p=3" rel="nofollow">http://idealian.net/?p=3</a></p>
<p>gwoo has a simpler approach<br />
<a href="http://bin.cakephp.org/saved/1237" rel="nofollow">http://bin.cakephp.org/saved/1237</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fat models and how they change how you use the Model class - cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/comment-page-1/#comment-58058</link>
		<dc:creator>Fat models and how they change how you use the Model class - cakebaker</dc:creator>
		<pubDate>Sat, 19 Jan 2008 10:36:35 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/#comment-58058</guid>
		<description>[...] Thinking about the model also forced me to think about the way I use and write models. This changed quite a bit over time. [...]</description>
		<content:encoded><![CDATA[<p>[...] Thinking about the model also forced me to think about the way I use and write models. This changed quite a bit over time. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/comment-page-1/#comment-58018</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Sat, 19 Jan 2008 07:09:37 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/#comment-58018</guid>
		<description>@rtconner: Singleton is evil ;-)  And if you look at what a model represents, a single data record (at least in theory), then you will see that it isn&#039;t a singleton.</description>
		<content:encoded><![CDATA[<p>@rtconner: Singleton is evil ;-)  And if you look at what a model represents, a single data record (at least in theory), then you will see that it isn&#8217;t a singleton.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rtconner</title>
		<link>http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/comment-page-1/#comment-57872</link>
		<dc:creator>rtconner</dc:creator>
		<pubDate>Fri, 18 Jan 2008 18:57:44 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2008/01/16/thinking-about-the-model/#comment-57872</guid>
		<description>While we&#039;re on changing models..
If I were writing cake .. I would have the models follow the singleton patterm. The way data is retrieved in cake there is no need for more than one instance of a model. I believe this is psuedo implemented with the ClassRegistry class.</description>
		<content:encoded><![CDATA[<p>While we&#8217;re on changing models..<br />
If I were writing cake .. I would have the models follow the singleton patterm. The way data is retrieved in cake there is no need for more than one instance of a model. I believe this is psuedo implemented with the ClassRegistry class.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
