<?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>“外刊IT评论网”的评论</title>
	<atom:link href="http://www.aqee.net/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.aqee.net</link>
	<description>国外IT评论,编程技巧,网站开发趋势,创业</description>
	<lastBuildDate>Sun, 05 Feb 2012 07:43:24 +0800</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>gaobaba 对《【外刊IT评论网】反for-if编程模式》的评论</title>
		<link>http://www.aqee.net/introducing-the-for-if-anti-pattern/comment-page-1/#comment-3930</link>
		<dc:creator>gaobaba</dc:creator>
		<pubDate>Sun, 05 Feb 2012 07:43:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.aqee.net/?p=3381#comment-3930</guid>
		<description>这真的是个常见的问题。不过，因为举的两个例子都比较夸张，程序员或许或认为，我才不会这么写代码。

常见的情形是，一个功能需要完成两个动作，一个是查找对象，查找的结果可能是一个，也可能是一组，然后在针对查找的对象做一些操作。

这个时候，要考虑单一职能原则，将查找和针对查找结果的操作分开。但我看到太多的代码，是将它们混在一起的。这就是这个 for-if anti-pattern 的隐晦形式。

在实际的代码中，会有若干种不同的查找需求，针对结果的操作也会有一些不同的变化。混在一起的结果，因为组合方式不同，不少代码功能类似，却很难提取成公用模块，造成大量的重复代码。

按这个思路去思考，就很容易看出文中的两个例子该如何修改了。</description>
		<content:encoded><![CDATA[<p>这真的是个常见的问题。不过，因为举的两个例子都比较夸张，程序员或许或认为，我才不会这么写代码。</p>
<p>常见的情形是，一个功能需要完成两个动作，一个是查找对象，查找的结果可能是一个，也可能是一组，然后在针对查找的对象做一些操作。</p>
<p>这个时候，要考虑单一职能原则，将查找和针对查找结果的操作分开。但我看到太多的代码，是将它们混在一起的。这就是这个 for-if anti-pattern 的隐晦形式。</p>
<p>在实际的代码中，会有若干种不同的查找需求，针对结果的操作也会有一些不同的变化。混在一起的结果，因为组合方式不同，不少代码功能类似，却很难提取成公用模块，造成大量的重复代码。</p>
<p>按这个思路去思考，就很容易看出文中的两个例子该如何修改了。</p>
]]></content:encoded>
	</item>
	<item>
		<title>gaobaba 对《【外刊IT评论网】反for-if编程模式》的评论</title>
		<link>http://www.aqee.net/introducing-the-for-if-anti-pattern/comment-page-1/#comment-3929</link>
		<dc:creator>gaobaba</dc:creator>
		<pubDate>Sun, 05 Feb 2012 07:23:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.aqee.net/?p=3381#comment-3929</guid>
		<description>同意。

标题给人的感觉是，咦，这个 for-if 模式是什么。但这里并不存在一个 for-if 模式给人去反。

这里的反模式(anti-pattern) 是常见错误的意思。</description>
		<content:encoded><![CDATA[<p>同意。</p>
<p>标题给人的感觉是，咦，这个 for-if 模式是什么。但这里并不存在一个 for-if 模式给人去反。</p>
<p>这里的反模式(anti-pattern) 是常见错误的意思。</p>
]]></content:encoded>
	</item>
	<item>
		<title>OSX 对《【外刊IT评论网】Mac Vs. PC》的评论</title>
		<link>http://www.aqee.net/mac-vs-pc/comment-page-1/#comment-3928</link>
		<dc:creator>OSX</dc:creator>
		<pubDate>Sun, 05 Feb 2012 06:40:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.aqee.net/?p=869#comment-3928</guid>
		<description>我的PC上只装了mac系统，那么它是PC还是MAC？现在Mac OS X已经不只属于Mac机了，另外Mac机还可以装其他系统，包括Windows和Linux，FreeBSD</description>
		<content:encoded><![CDATA[<p>我的PC上只装了mac系统，那么它是PC还是MAC？现在Mac OS X已经不只属于Mac机了，另外Mac机还可以装其他系统，包括Windows和Linux，FreeBSD</p>
]]></content:encoded>
	</item>
	<item>
		<title>依云 对《【外刊IT评论网】反for-if编程模式》的评论</title>
		<link>http://www.aqee.net/introducing-the-for-if-anti-pattern/comment-page-1/#comment-3927</link>
		<dc:creator>依云</dc:creator>
		<pubDate>Sun, 05 Feb 2012 06:16:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.aqee.net/?p=3381#comment-3927</guid>
		<description>@shindo: 这样只能说明文件系统太笨了。我知道有些文件系统的目录项是使用查找树实现的，所以即使有大量文件查找起来也不慢。</description>
		<content:encoded><![CDATA[<p>@shindo: 这样只能说明文件系统太笨了。我知道有些文件系统的目录项是使用查找树实现的，所以即使有大量文件查找起来也不慢。</p>
]]></content:encoded>
	</item>
	<item>
		<title>酿泉 对《【外刊IT评论网】这张照片是免费的》的评论</title>
		<link>http://www.aqee.net/this-photograph-is-free/comment-page-1/#comment-3924</link>
		<dc:creator>酿泉</dc:creator>
		<pubDate>Sat, 04 Feb 2012 12:21:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.aqee.net/?p=3344#comment-3924</guid>
		<description>我觉得《不免费》这文章是反讽
反串黑</description>
		<content:encoded><![CDATA[<p>我觉得《不免费》这文章是反讽<br />
反串黑</p>
]]></content:encoded>
	</item>
	<item>
		<title>aqee 对《【外刊IT评论网】这张照片是免费的》的评论</title>
		<link>http://www.aqee.net/this-photograph-is-free/comment-page-1/#comment-3921</link>
		<dc:creator>aqee</dc:creator>
		<pubDate>Sat, 04 Feb 2012 02:10:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.aqee.net/?p=3344#comment-3921</guid>
		<description>谢谢提醒，这个错误很搞笑，以改正</description>
		<content:encoded><![CDATA[<p>谢谢提醒，这个错误很搞笑，以改正</p>
]]></content:encoded>
	</item>
	<item>
		<title>老虎 对《【外刊IT评论网】这张照片是免费的》的评论</title>
		<link>http://www.aqee.net/this-photograph-is-free/comment-page-1/#comment-3920</link>
		<dc:creator>老虎</dc:creator>
		<pubDate>Fri, 03 Feb 2012 12:37:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.aqee.net/?p=3344#comment-3920</guid>
		<description>“一个康佳单反相机&quot;…… classic.</description>
		<content:encoded><![CDATA[<p>“一个康佳单反相机”…… classic.</p>
]]></content:encoded>
	</item>
	<item>
		<title>WAM 对《【外刊IT评论网】一个程序员怎么能做出这样的事情？》的评论</title>
		<link>http://www.aqee.net/why-on-earth-would-a-developer-do-this/comment-page-1/#comment-3919</link>
		<dc:creator>WAM</dc:creator>
		<pubDate>Fri, 03 Feb 2012 07:48:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.aqee.net/?p=2206#comment-3919</guid>
		<description>一个字&quot;稳&quot;！</description>
		<content:encoded><![CDATA[<p>一个字”稳”！</p>
]]></content:encoded>
	</item>
	<item>
		<title>WAM 对《【外刊IT评论网】一个程序员怎么能做出这样的事情？》的评论</title>
		<link>http://www.aqee.net/why-on-earth-would-a-developer-do-this/comment-page-1/#comment-3918</link>
		<dc:creator>WAM</dc:creator>
		<pubDate>Fri, 03 Feb 2012 07:47:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.aqee.net/?p=2206#comment-3918</guid>
		<description>写程序,不单只已完成一个功能为目的，还要让程序读出来的数据不产生冗余,最主要的是可控性和可扩展性，万一又加了一个数据库，只用到里面的ID，这样其余的数据的浪费了，造成不必要的负担。&quot;船到桥头自然直&quot;</description>
		<content:encoded><![CDATA[<p>写程序,不单只已完成一个功能为目的，还要让程序读出来的数据不产生冗余,最主要的是可控性和可扩展性，万一又加了一个数据库，只用到里面的ID，这样其余的数据的浪费了，造成不必要的负担。”船到桥头自然直”</p>
]]></content:encoded>
	</item>
	<item>
		<title>少室山 对《【外刊IT评论网】这张照片是免费的》的评论</title>
		<link>http://www.aqee.net/this-photograph-is-free/comment-page-1/#comment-3917</link>
		<dc:creator>少室山</dc:creator>
		<pubDate>Fri, 03 Feb 2012 07:42:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.aqee.net/?p=3344#comment-3917</guid>
		<description>“一个康佳单反相机”，年还真是没过完</description>
		<content:encoded><![CDATA[<p>“一个康佳单反相机”，年还真是没过完</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching 3/25 queries in 0.012 seconds using disk: basic
Object Caching 442/468 objects using disk: basic

Served from: www.aqee.net @ 2012-02-05 22:00:04 -->
