<?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: Pseudo models</title>
	<atom:link href="http://cakebaker.42dh.com/2008/09/11/pseudo-models/feed/" rel="self" type="application/rss+xml" />
	<link>http://cakebaker.42dh.com/2008/09/11/pseudo-models/</link>
	<description>baking cakes with CakePHP</description>
	<lastBuildDate>Thu, 11 Mar 2010 15:41:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/09/11/pseudo-models/comment-page-1/#comment-106590</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Mon, 15 Sep 2008 16:55:02 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=799#comment-106590</guid>
		<description>@Simon: Thanks for your comment!

To realize it as a data source is a possible solution. In NoseRub we implemented the same functionality as a component ;-)  So you see: different developers, different approaches to solve the same problem...

In the meantime I would probably realize it as a vendor class (as there is no &quot;libs&quot; concept in the &quot;app&quot; folder). Personally, I don&#039;t see it as a data source, because all the API does is to translate an address to coordinates: you send some data and you get back the same data in a different format. In the end it depends on what your definition of a data source is.</description>
		<content:encoded><![CDATA[<p>@Simon: Thanks for your comment!</p>
<p>To realize it as a data source is a possible solution. In NoseRub we implemented the same functionality as a component ;-)  So you see: different developers, different approaches to solve the same problem&#8230;</p>
<p>In the meantime I would probably realize it as a vendor class (as there is no &#8220;libs&#8221; concept in the &#8220;app&#8221; folder). Personally, I don&#8217;t see it as a data source, because all the API does is to translate an address to coordinates: you send some data and you get back the same data in a different format. In the end it depends on what your definition of a data source is.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: powtac</title>
		<link>http://cakebaker.42dh.com/2008/09/11/pseudo-models/comment-page-1/#comment-106548</link>
		<dc:creator>powtac</dc:creator>
		<pubDate>Sun, 14 Sep 2008 08:31:20 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=799#comment-106548</guid>
		<description>Good article, thanks for the hint. 

But some days ago I needed a wrapper for the google maps. My question then was: should I build a datasource or a AppModel-class. The features I required from google maps where: to receive the coordinates for an address. So I decided to build the wrapper as datasource (because it returns data). 

What do you think?
Simon</description>
		<content:encoded><![CDATA[<p>Good article, thanks for the hint. </p>
<p>But some days ago I needed a wrapper for the google maps. My question then was: should I build a datasource or a AppModel-class. The features I required from google maps where: to receive the coordinates for an address. So I decided to build the wrapper as datasource (because it returns data). </p>
<p>What do you think?<br />
Simon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/09/11/pseudo-models/comment-page-1/#comment-106444</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Fri, 12 Sep 2008 17:02:36 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=799#comment-106444</guid>
		<description>@Brandon, Tarique, Martin: Thanks for your comments!

@Brandon: Well, I think it depends on your point of view whether it is incorrect to put classes, which do not extend AppModel, in the models folder. If you say all classes in the models folder have to extend AppModel, then you are right, and it&#039;s messy to put other classes into the models folder. On the other hand, if your point of view is on a more abstract level, then the implementation of a model is no longer important. Extending AppModel is one of many ways you could implement, for example, the Post model...

I also use the approach you described for &quot;helper&quot; functionality, but personally I don&#039;t like it. It feels wrong to me to have third-party-libraries and my own code in the same folder...

@Tarique: Yes, you are right, the name is probably a bit unlucky :&#124; 

@Martin: I think there is no definite answer to where you should place such functionality. Sometimes the best way is to leave Cake&#039;s structure and to implement it in a way you think is more suitable for the task at hand.</description>
		<content:encoded><![CDATA[<p>@Brandon, Tarique, Martin: Thanks for your comments!</p>
<p>@Brandon: Well, I think it depends on your point of view whether it is incorrect to put classes, which do not extend AppModel, in the models folder. If you say all classes in the models folder have to extend AppModel, then you are right, and it&#8217;s messy to put other classes into the models folder. On the other hand, if your point of view is on a more abstract level, then the implementation of a model is no longer important. Extending AppModel is one of many ways you could implement, for example, the Post model&#8230;</p>
<p>I also use the approach you described for &#8220;helper&#8221; functionality, but personally I don&#8217;t like it. It feels wrong to me to have third-party-libraries and my own code in the same folder&#8230;</p>
<p>@Tarique: Yes, you are right, the name is probably a bit unlucky :| </p>
<p>@Martin: I think there is no definite answer to where you should place such functionality. Sometimes the best way is to leave Cake&#8217;s structure and to implement it in a way you think is more suitable for the task at hand.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Westin</title>
		<link>http://cakebaker.42dh.com/2008/09/11/pseudo-models/comment-page-1/#comment-106416</link>
		<dc:creator>Martin Westin</dc:creator>
		<pubDate>Fri, 12 Sep 2008 09:15:43 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=799#comment-106416</guid>
		<description>A very interesting area.
I find is very difficult to categorize &quot;communication&quot; functionality (soap or other services for example).
They are not really models even though they deal with a lot business logic.
They need to partly be controllers to be abel to handle incoming requests but they ar not really controller either.
And they are not clearly components either.

For an app I have build that sends and receives a lot of SMS messages I ended up putting all of the above into a plugin. A controller to handle incoming requests, Models to deal with data and some logic, and a component so that any other controller can decide to send an outgoing message. I am still not happy with it though.</description>
		<content:encoded><![CDATA[<p>A very interesting area.<br />
I find is very difficult to categorize &#8220;communication&#8221; functionality (soap or other services for example).<br />
They are not really models even though they deal with a lot business logic.<br />
They need to partly be controllers to be abel to handle incoming requests but they ar not really controller either.<br />
And they are not clearly components either.</p>
<p>For an app I have build that sends and receives a lot of SMS messages I ended up putting all of the above into a plugin. A controller to handle incoming requests, Models to deal with data and some logic, and a component so that any other controller can decide to send an outgoing message. I am still not happy with it though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tarique Sani</title>
		<link>http://cakebaker.42dh.com/2008/09/11/pseudo-models/comment-page-1/#comment-106407</link>
		<dc:creator>Tarique Sani</dc:creator>
		<pubDate>Fri, 12 Sep 2008 06:06:37 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=799#comment-106407</guid>
		<description>Why do you call them pseudo-models? They are models which do not extend the app model. If these classes contain domain logic then by MVC guidelines they are Models. 

I find a whole lot of people just don&#039;t get the point of MVC but in a reverse way ;)

@Brandon P your example is comparing apples to oranges.</description>
		<content:encoded><![CDATA[<p>Why do you call them pseudo-models? They are models which do not extend the app model. If these classes contain domain logic then by MVC guidelines they are Models. </p>
<p>I find a whole lot of people just don&#8217;t get the point of MVC but in a reverse way ;)</p>
<p>@Brandon P your example is comparing apples to oranges.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: links for 2008-09-11 &#171; Richard@Home</title>
		<link>http://cakebaker.42dh.com/2008/09/11/pseudo-models/comment-page-1/#comment-106404</link>
		<dc:creator>links for 2008-09-11 &#171; Richard@Home</dc:creator>
		<pubDate>Fri, 12 Sep 2008 05:31:22 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=799#comment-106404</guid>
		<description>[...] Pseudo models - cakebaker Another useful tip from cakebaker. (tags: cakephp model)       Posted by Richard@Home Filed in 15 [...]</description>
		<content:encoded><![CDATA[<p>[...] Pseudo models &#8211; cakebaker Another useful tip from cakebaker. (tags: cakephp model)       Posted by Richard@Home Filed in 15 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon P</title>
		<link>http://cakebaker.42dh.com/2008/09/11/pseudo-models/comment-page-1/#comment-106385</link>
		<dc:creator>Brandon P</dc:creator>
		<pubDate>Fri, 12 Sep 2008 00:10:32 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=799#comment-106385</guid>
		<description>Sry, code didnt post:

bootstrap.php

set_include_path(get_include_path() . PATH SEPARATOR . ../path/to/vendors/classes&#039; );

require_once &#039;common.php&#039;;


In my app:

Common::getServerTime();</description>
		<content:encoded><![CDATA[<p>Sry, code didnt post:</p>
<p>bootstrap.php</p>
<p>set_include_path(get_include_path() . PATH SEPARATOR . ../path/to/vendors/classes&#8217; );</p>
<p>require_once &#8216;common.php&#8217;;</p>
<p>In my app:</p>
<p>Common::getServerTime();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon P</title>
		<link>http://cakebaker.42dh.com/2008/09/11/pseudo-models/comment-page-1/#comment-106384</link>
		<dc:creator>Brandon P</dc:creator>
		<pubDate>Fri, 12 Sep 2008 00:09:06 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=799#comment-106384</guid>
		<description>Great concept but putting these classes that are NOT models in the ./models folder is incorrect, messy and will only lead to confusion!!

I use a similar technique where I have a static &quot;Common&quot; class that give me access to common functionality  that I use pretty much all over my app (in models, views, etc).

I created a &#039;classes&#039; directory within ./app/vendors (imo, a more appropriate place)

./app/vendors/classes/common.php

And then included it on my bootstrap


Then I can use it statically:
</description>
		<content:encoded><![CDATA[<p>Great concept but putting these classes that are NOT models in the ./models folder is incorrect, messy and will only lead to confusion!!</p>
<p>I use a similar technique where I have a static &#8220;Common&#8221; class that give me access to common functionality  that I use pretty much all over my app (in models, views, etc).</p>
<p>I created a &#8216;classes&#8217; directory within ./app/vendors (imo, a more appropriate place)</p>
<p>./app/vendors/classes/common.php</p>
<p>And then included it on my bootstrap</p>
<p>Then I can use it statically:</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/09/11/pseudo-models/comment-page-1/#comment-106342</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Thu, 11 Sep 2008 15:24:14 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=799#comment-106342</guid>
		<description>@David, Kien: Thanks for your comments!

@David: Yes, ClassRegistry::init(&#039;PseudoModel&#039;); still works.</description>
		<content:encoded><![CDATA[<p>@David, Kien: Thanks for your comments!</p>
<p>@David: Yes, ClassRegistry::init(&#8216;PseudoModel&#8217;); still works.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kien Pham</title>
		<link>http://cakebaker.42dh.com/2008/09/11/pseudo-models/comment-page-1/#comment-106328</link>
		<dc:creator>Kien Pham</dc:creator>
		<pubDate>Thu, 11 Sep 2008 13:48:13 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=799#comment-106328</guid>
		<description>cool tip! thanks for sharing.</description>
		<content:encoded><![CDATA[<p>cool tip! thanks for sharing.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
