<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>IT Farmer的博客 &#187; design pattern</title>
	<atom:link href="http://www.it-farmer.com/tag/design-pattern/feed" rel="self" type="application/rss+xml" />
	<link>http://www.it-farmer.com</link>
	<description>关于软件, 技术, 生活的点滴记录</description>
	<lastBuildDate>Sun, 25 Jul 2010 08:50:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>设计模式5: Singleton模式</title>
		<link>http://www.it-farmer.com/design-pattern-singleton.html</link>
		<comments>http://www.it-farmer.com/design-pattern-singleton.html#comments</comments>
		<pubDate>Sun, 27 Apr 2008 12:00:57 +0000</pubDate>
		<dc:creator>ITFramer</dc:creator>
				<category><![CDATA[博客]]></category>
		<category><![CDATA[design pattern]]></category>
		<category><![CDATA[singleton]]></category>

		<guid isPermaLink="false">http://www.it-farmer.com/?p=130</guid>
		<description><![CDATA[何时使用Singleton对象: 1. 对象有且只有一个实例 2. 对象需要Lazy Initialization 3. 没有全局访问的方法 // Make the class responsible for its own // global pointer and "initialization on // first use" (by using a private static // pointer and a public static accessor // method). The client uses only the public // accessor method.class GlobalClass {   int m_value;   static [...]]]></description>
		<wfw:commentRss>http://www.it-farmer.com/design-pattern-singleton.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>设计模式4: Factory方法</title>
		<link>http://www.it-farmer.com/design-pattern-factory.html</link>
		<comments>http://www.it-farmer.com/design-pattern-factory.html#comments</comments>
		<pubDate>Sat, 26 Apr 2008 11:45:49 +0000</pubDate>
		<dc:creator>ITFramer</dc:creator>
				<category><![CDATA[博客]]></category>
		<category><![CDATA[design pattern]]></category>
		<category><![CDATA[Factory]]></category>

		<guid isPermaLink="false">http://www.it-farmer.com/?p=129</guid>
		<description><![CDATA[使用一个静态方法创建子类对象： // A factory method is a static method of a class that // returns an object of that class' type. But unlike a // constructor, the actual object it returns might be // an instance of a subclass. Another advantage of a // factory method is that it can return existing // instances multiple [...]]]></description>
		<wfw:commentRss>http://www.it-farmer.com/design-pattern-factory.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>设计模式3: Strategy模式</title>
		<link>http://www.it-farmer.com/design-pattern-strategy.html</link>
		<comments>http://www.it-farmer.com/design-pattern-strategy.html#comments</comments>
		<pubDate>Fri, 25 Apr 2008 11:34:52 +0000</pubDate>
		<dc:creator>ITFramer</dc:creator>
				<category><![CDATA[博客]]></category>
		<category><![CDATA[design pattern]]></category>
		<category><![CDATA[设计模式]]></category>

		<guid isPermaLink="false">http://www.it-farmer.com/?p=128</guid>
		<description><![CDATA[看下面的实例， 程序中需要有不同的对日期格式化的方法。 Strategy模式的思路如下： １.　定义格式化日期的抽象接口 ２.　不同的格式化类实现该接口 ３.　客户类BillingSystem可以保存格式化的接口引用。 好处是显而易见的，修改添加格式化方法的时候，客户类不需要改变。 interface DateFormatStrategy { String format_date( Date d ); } class BillingSystem { private DateFormatStrategy formatter = null; public  void set_format( DateFormatStrategy dfs ) { formatter = dfs; } public  void print_statement( Date now ) { if (formatter == null) System.out.println( now.toString() ); else System.out.println( formatter.format_date( now ) ); [...]]]></description>
		<wfw:commentRss>http://www.it-farmer.com/design-pattern-strategy.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>设计模式1:FlyWeight模式</title>
		<link>http://www.it-farmer.com/design-pattern-flyweight.html</link>
		<comments>http://www.it-farmer.com/design-pattern-flyweight.html#comments</comments>
		<pubDate>Mon, 21 Apr 2008 15:46:31 +0000</pubDate>
		<dc:creator>ITFramer</dc:creator>
				<category><![CDATA[博客]]></category>
		<category><![CDATA[design pattern]]></category>
		<category><![CDATA[flyweight]]></category>
		<category><![CDATA[设计模式]]></category>

		<guid isPermaLink="false">http://www.it-farmer.com/?p=122</guid>
		<description><![CDATA[场景： 试想如果需要实现一个丰富的文本编辑器(Rich Text)，对于每一个字符，可以用一个类来表示，记录该字符的位置，大小，字体，颜色，Unicode值等等。这是一个简单的设计，但仔细想一下，在一篇很长的文档中，同样大小或字体的字符可能会很多。如果每个字符都记录同样的信息，那势必要浪费很多空间。 解决方案： 使用FlyWeight模式，把格式信息比如字体，大小，颜色抽象为一个Format类，在每一个字符类中存储格式类的指针。那么很多字符类实例就可以共享同一个格式类。 http://c2.com/cgi/wiki?FlyweightPattern Related Posts:开源的虚拟机软件VirtualBoxVisual Studio Profiler关于面向对象设计的10大原则Hyper-VNginx + Django SetupPowered by Contextual Related Posts]]></description>
		<wfw:commentRss>http://www.it-farmer.com/design-pattern-flyweight.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
