<?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: Secret Santa</title>
	<atom:link href="http://mikenaberezny.com/2005/12/16/secret-santa/feed/" rel="self" type="application/rss+xml" />
	<link>http://mikenaberezny.com/2005/12/16/secret-santa/</link>
	<description></description>
	<pubDate>Wed, 07 Jan 2009 11:18:30 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Thomas David Baker</title>
		<link>http://mikenaberezny.com/2005/12/16/secret-santa/comment-page-1/#comment-311</link>
		<dc:creator>Thomas David Baker</dc:creator>
		<pubDate>Fri, 24 Feb 2006 16:36:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikenaberezny.com/?p=34#comment-311</guid>
		<description>Isn't it?

What about ...

http://www.paulgraham.com/power.html

It's an interesting argument.</description>
		<content:encoded><![CDATA[<p>Isn&#8217;t it?</p>
<p>What about &#8230;</p>
<p><a href="http://www.paulgraham.com/power.html" rel="nofollow">http://www.paulgraham.com/power.html</a></p>
<p>It&#8217;s an interesting argument.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott</title>
		<link>http://mikenaberezny.com/2005/12/16/secret-santa/comment-page-1/#comment-295</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Mon, 06 Feb 2006 09:08:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikenaberezny.com/?p=34#comment-295</guid>
		<description>These comparisons are fruitless.  It's not about doing it in x% of the code.  For that matter:

x = %w(Paul Matthew Daniel).sort_by { rand }
pp x.zip((z = x.dup).unshift(z.pop))


Whoopdy doo.</description>
		<content:encoded><![CDATA[<p>These comparisons are fruitless.  It&#8217;s not about doing it in x% of the code.  For that matter:</p>
<p>x = %w(Paul Matthew Daniel).sort_by { rand }<br />
pp x.zip((z = x.dup).unshift(z.pop))</p>
<p>Whoopdy doo.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://mikenaberezny.com/2005/12/16/secret-santa/comment-page-1/#comment-245</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Sat, 17 Dec 2005 23:38:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikenaberezny.com/?p=34#comment-245</guid>
		<description>That's a nice example.  I think that is a much better, apples-to-apples comparison.  I could send the bloated PHP 5 version to match the Ruby version from earlier if you'd think that would be more manageable than eight simple lines of code, although that's probably not necessary.  This is a much more appropriate amount of code for doing such an everyday silly task, and our two examples show a real comparison nicely.  For this example, it looks about even.

It is refreshing to finally see a direct comparison of some PHP and Ruby code, and more of this is sorely needed in place of all this hype comparing only a language (PHP) to an entire framework (Rails).  More of this is needed in the future.

I would perhaps be more interested in seeing examples comparing Ruby to Python as well; I only chose PHP as that seems to be the favorite target of your camp.  That's understandable, it is the elephant.  

Thanks for your comments.</description>
		<content:encoded><![CDATA[<p>That&#8217;s a nice example.  I think that is a much better, apples-to-apples comparison.  I could send the bloated PHP 5 version to match the Ruby version from earlier if you&#8217;d think that would be more manageable than eight simple lines of code, although that&#8217;s probably not necessary.  This is a much more appropriate amount of code for doing such an everyday silly task, and our two examples show a real comparison nicely.  For this example, it looks about even.</p>
<p>It is refreshing to finally see a direct comparison of some PHP and Ruby code, and more of this is sorely needed in place of all this hype comparing only a language (PHP) to an entire framework (Rails).  More of this is needed in the future.</p>
<p>I would perhaps be more interested in seeing examples comparing Ruby to Python as well; I only chose PHP as that seems to be the favorite target of your camp.  That&#8217;s understandable, it is the elephant.  </p>
<p>Thanks for your comments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ulysses</title>
		<link>http://mikenaberezny.com/2005/12/16/secret-santa/comment-page-1/#comment-244</link>
		<dc:creator>ulysses</dc:creator>
		<pubDate>Sat, 17 Dec 2005 15:32:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikenaberezny.com/?p=34#comment-244</guid>
		<description>Ah, quite right. Let me try this at 10AM instead of 2 AM:

to = %w(Paul Matthew Daniel)
loop do
  from = to.sort_by { rand }
  pairs = to.zip(from)
  next if pairs.any? { &#124;t, f&#124; t == f }
  pp pairs
  break
end

That's pretty much line for line the same. But I should really *comment* instead of just writing lame code.

"I think this is a fair comparison because it directly compares PHP to Ruby, without any “frameworks” or other middleware in between."

As we see above, you can get the same amount of code in Ruby. So your comparison is shot. I could go on to say "The comparison is really between doing a quick hack of something that is ugly but functional, and doing a cleaner version that has some possiblity for maintainence." But I won't.</description>
		<content:encoded><![CDATA[<p>Ah, quite right. Let me try this at 10AM instead of 2 AM:</p>
<p>to = %w(Paul Matthew Daniel)<br />
loop do<br />
  from = to.sort_by { rand }<br />
  pairs = to.zip(from)<br />
  next if pairs.any? { |t, f| t == f }<br />
  pp pairs<br />
  break<br />
end</p>
<p>That&#8217;s pretty much line for line the same. But I should really *comment* instead of just writing lame code.</p>
<p>&#8220;I think this is a fair comparison because it directly compares PHP to Ruby, without any “frameworks” or other middleware in between.&#8221;</p>
<p>As we see above, you can get the same amount of code in Ruby. So your comparison is shot. I could go on to say &#8220;The comparison is really between doing a quick hack of something that is ugly but functional, and doing a cleaner version that has some possiblity for maintainence.&#8221; But I won&#8217;t.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://mikenaberezny.com/2005/12/16/secret-santa/comment-page-1/#comment-243</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Sat, 17 Dec 2005 07:03:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikenaberezny.com/?p=34#comment-243</guid>
		<description>It might be 75% of the code, but it doesn't solve the problem at all.  You can't give a gift to yourself.  The equivalent PHP code for your program is below.

$from = $to = array('Paul', 'Matthew', 'Daniel', 'Andi', 'Chuck');
shuffle($to);
print_r(array_combine($from, $to));</description>
		<content:encoded><![CDATA[<p>It might be 75% of the code, but it doesn&#8217;t solve the problem at all.  You can&#8217;t give a gift to yourself.  The equivalent PHP code for your program is below.</p>
<p>$from = $to = array(&#8217;Paul&#8217;, &#8216;Matthew&#8217;, &#8216;Daniel&#8217;, &#8216;Andi&#8217;, &#8216;Chuck&#8217;);<br />
shuffle($to);<br />
print_r(array_combine($from, $to));</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ulysses</title>
		<link>http://mikenaberezny.com/2005/12/16/secret-santa/comment-page-1/#comment-242</link>
		<dc:creator>ulysses</dc:creator>
		<pubDate>Sat, 17 Dec 2005 06:44:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikenaberezny.com/?p=34#comment-242</guid>
		<description>to = ["Paul", "Matthew", ...]
from = to.dup
from.sort_by { rand }
from.each_with_index do &#124;i, index&#124;
  puts "#{i} =&#62; #{to[index]}"
end

That's 75% of the code... and it's almost as ugly as the php version.</description>
		<content:encoded><![CDATA[<p>to = ["Paul", "Matthew", ...]<br />
from = to.dup<br />
from.sort_by { rand }<br />
from.each_with_index do |i, index|<br />
  puts &#8220;#{i} =&gt; #{to[index]}&#8221;<br />
end</p>
<p>That&#8217;s 75% of the code&#8230; and it&#8217;s almost as ugly as the php version.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lord sarthin</title>
		<link>http://mikenaberezny.com/2005/12/16/secret-santa/comment-page-1/#comment-241</link>
		<dc:creator>lord sarthin</dc:creator>
		<pubDate>Fri, 16 Dec 2005 17:36:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikenaberezny.com/?p=34#comment-241</guid>
		<description>i'm cheering for django as well. Its a great package, cool community and they're constantly improving it. Plus it powers some fantastic sites.</description>
		<content:encoded><![CDATA[<p>i&#8217;m cheering for django as well. Its a great package, cool community and they&#8217;re constantly improving it. Plus it powers some fantastic sites.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: metapundit</title>
		<link>http://mikenaberezny.com/2005/12/16/secret-santa/comment-page-1/#comment-240</link>
		<dc:creator>metapundit</dc:creator>
		<pubDate>Fri, 16 Dec 2005 17:01:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.mikenaberezny.com/?p=34#comment-240</guid>
		<description>FWIW I'm a php coder so I understand the php example better than the ruby version. Still, looking at the two samples I can't help but feel the ruby one is a little more expressive and a little less hacky.  This could be partially fixed by replacing "for(;;)" by "while(true)" in the php version but still the "continue 2" and break calls always seem only a step or two above gotos to me.  

Partly aesthetics I guess, which makes it a bit subjective. I've not done anything in ruby, but I do envy the more expressive nature both ruby and python code seem to have over php... Oh yeah and I'm interested in turbo gears over django as far as the web frameworks for python goes...</description>
		<content:encoded><![CDATA[<p>FWIW I&#8217;m a php coder so I understand the php example better than the ruby version. Still, looking at the two samples I can&#8217;t help but feel the ruby one is a little more expressive and a little less hacky.  This could be partially fixed by replacing &#8220;for(;;)&#8221; by &#8220;while(true)&#8221; in the php version but still the &#8220;continue 2&#8243; and break calls always seem only a step or two above gotos to me.  </p>
<p>Partly aesthetics I guess, which makes it a bit subjective. I&#8217;ve not done anything in ruby, but I do envy the more expressive nature both ruby and python code seem to have over php&#8230; Oh yeah and I&#8217;m interested in turbo gears over django as far as the web frameworks for python goes&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in -0.417 seconds -->
