<?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: The &#8220;Multitype Parameter&#8221; Pattern</title>
	<atom:link href="http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/feed/" rel="self" type="application/rss+xml" />
	<link>http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/</link>
	<description>baking cakes with CakePHP</description>
	<lastBuildDate>Tue, 31 Jan 2012 15:12:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/comment-page-1/#comment-10708</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Thu, 16 Aug 2007 16:42:11 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/#comment-10708</guid>
		<description>@Berry: Yes, you are right, it is a PHP-specific pattern.</description>
		<content:encoded><![CDATA[<p>@Berry: Yes, you are right, it is a PHP-specific pattern.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Berry</title>
		<link>http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/comment-page-1/#comment-10703</link>
		<dc:creator>Berry</dc:creator>
		<pubDate>Thu, 16 Aug 2007 07:42:43 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/#comment-10703</guid>
		<description>It doesn&#039;t have an official name, nor will it ever get one. The example you&#039;ve shown will only work in PHP, because of the non-strict typing. Thus, it can never become an actual pattern. Nevertheless, in other languages overloading can be used, but that makes it overloading, nothing more, nothing less.</description>
		<content:encoded><![CDATA[<p>It doesn&#8217;t have an official name, nor will it ever get one. The example you&#8217;ve shown will only work in PHP, because of the non-strict typing. Thus, it can never become an actual pattern. Nevertheless, in other languages overloading can be used, but that makes it overloading, nothing more, nothing less.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/comment-page-1/#comment-7453</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Tue, 26 Jun 2007 16:37:12 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/#comment-7453</guid>
		<description>@Geoff, Brandon, bododo: Thanks for your comments.

@Brandon: Yes, it should be used with caution, but for methods like FormHelper::input() it is really handy.</description>
		<content:encoded><![CDATA[<p>@Geoff, Brandon, bododo: Thanks for your comments.</p>
<p>@Brandon: Yes, it should be used with caution, but for methods like FormHelper::input() it is really handy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bododo</title>
		<link>http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/comment-page-1/#comment-7221</link>
		<dc:creator>bododo</dc:creator>
		<pubDate>Tue, 19 Jun 2007 22:11:03 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/#comment-7221</guid>
		<description>blesssed is python for its functions parameters syntax: named params, lists... :-)</description>
		<content:encoded><![CDATA[<p>blesssed is python for its functions parameters syntax: named params, lists&#8230; :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon</title>
		<link>http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/comment-page-1/#comment-7211</link>
		<dc:creator>Brandon</dc:creator>
		<pubDate>Tue, 19 Jun 2007 16:47:11 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/#comment-7211</guid>
		<description>The formal defining of parameters in functions is a convention that was created long before multi-dim arrays or objects were conceived.

IMO, I think the &quot;multitype&quot; design pattern is becoming more and more popular because of its extensibility and the overall trend of decreasing dependencies on strict data typing (i love you php!)

But, I definitely think this design should be used with caution.  Especially in large projects where people rely on API&#039;s to communicate functions roles.

One of the biggest issues I see is the issue of returning unexpected results.  Since these types of function almost ALWAYS merge with default values.</description>
		<content:encoded><![CDATA[<p>The formal defining of parameters in functions is a convention that was created long before multi-dim arrays or objects were conceived.</p>
<p>IMO, I think the &#8220;multitype&#8221; design pattern is becoming more and more popular because of its extensibility and the overall trend of decreasing dependencies on strict data typing (i love you php!)</p>
<p>But, I definitely think this design should be used with caution.  Especially in large projects where people rely on API&#8217;s to communicate functions roles.</p>
<p>One of the biggest issues I see is the issue of returning unexpected results.  Since these types of function almost ALWAYS merge with default values.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Geoff</title>
		<link>http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/comment-page-1/#comment-7197</link>
		<dc:creator>Geoff</dc:creator>
		<pubDate>Tue, 19 Jun 2007 11:35:00 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/#comment-7197</guid>
		<description>I like and have used the &quot;multiple parameter&quot; stuff quite a bit.  It not that hard to support. It is very good for setting default settings and then only overriding the ones required.  It is very similar to the way JQuery plugins take settings via a JSON object.

I think it produces cleaner code and adds to readability in the end, much nicer than heaps of nulls or false in a function call</description>
		<content:encoded><![CDATA[<p>I like and have used the &#8220;multiple parameter&#8221; stuff quite a bit.  It not that hard to support. It is very good for setting default settings and then only overriding the ones required.  It is very similar to the way JQuery plugins take settings via a JSON object.</p>
<p>I think it produces cleaner code and adds to readability in the end, much nicer than heaps of nulls or false in a function call</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/comment-page-1/#comment-7188</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Tue, 19 Jun 2007 07:33:07 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/#comment-7188</guid>
		<description>@all: Thanks for your comments.</description>
		<content:encoded><![CDATA[<p>@all: Thanks for your comments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/comment-page-1/#comment-7158</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Mon, 18 Jun 2007 15:54:29 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/#comment-7158</guid>
		<description>Well, I don&#039;t think we really have a name for it, but &quot;Multitype parameter&quot; sounds good to me. ;-)

I&#039;ve actually taken this a step further in several methods by allowing the omission of certain parameters, i.e. the model name as the first parameter to FormHelper::create().  If an array is passed as the first parameter, it is auto-interpreted as the second.

@JMG: Exactly.  Lack of clarity it not a design goal of CakePHP.</description>
		<content:encoded><![CDATA[<p>Well, I don&#8217;t think we really have a name for it, but &#8220;Multitype parameter&#8221; sounds good to me. ;-)</p>
<p>I&#8217;ve actually taken this a step further in several methods by allowing the omission of certain parameters, i.e. the model name as the first parameter to FormHelper::create().  If an array is passed as the first parameter, it is auto-interpreted as the second.</p>
<p>@JMG: Exactly.  Lack of clarity it not a design goal of CakePHP.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Grant Cox</title>
		<link>http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/comment-page-1/#comment-7151</link>
		<dc:creator>Grant Cox</dc:creator>
		<pubDate>Mon, 18 Jun 2007 12:00:50 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/#comment-7151</guid>
		<description>Yes, being verbose in this case is more readable, not less - if you want it to be simple just use &quot;/users/add&quot; - use the convention that already exists.

As for the OP, I find the extensibility of array params to be very attractive (and I&#039;ve been burned on an old project which ended up with stupid amounts of parameters due to feature creep over the years).  But in the majority of cases it just seems &quot;right&quot; to use normal parameters - if you only think you need $user_id and $group_id, then having an array param is just overkill.

I can&#039;t say that I ever support both cases like the Cake core - but then I&#039;m not in the library / framework writing business.  I certainly appreciate the work the core devs have done though - their hard work allows me to have simplicity / extensibility as I need it.</description>
		<content:encoded><![CDATA[<p>Yes, being verbose in this case is more readable, not less &#8211; if you want it to be simple just use &#8220;/users/add&#8221; &#8211; use the convention that already exists.</p>
<p>As for the OP, I find the extensibility of array params to be very attractive (and I&#8217;ve been burned on an old project which ended up with stupid amounts of parameters due to feature creep over the years).  But in the majority of cases it just seems &#8220;right&#8221; to use normal parameters &#8211; if you only think you need $user_id and $group_id, then having an array param is just overkill.</p>
<p>I can&#8217;t say that I ever support both cases like the Cake core &#8211; but then I&#8217;m not in the library / framework writing business.  I certainly appreciate the work the core devs have done though &#8211; their hard work allows me to have simplicity / extensibility as I need it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JMG</title>
		<link>http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/comment-page-1/#comment-7150</link>
		<dc:creator>JMG</dc:creator>
		<pubDate>Mon, 18 Jun 2007 11:38:29 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/06/18/the-multitype-parameter-pattern/#comment-7150</guid>
		<description>I think you&#039;re wrong : &#039;controller&#039; and &#039;action&#039; do have a meaning; &#039;c&#039; and &#039;a&#039;... just don&#039;t.</description>
		<content:encoded><![CDATA[<p>I think you&#8217;re wrong : &#8216;controller&#8217; and &#8216;action&#8217; do have a meaning; &#8216;c&#8217; and &#8216;a&#8217;&#8230; just don&#8217;t.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

