<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园__分类_设计模式</title><id>http://feed.cnblogs.com/blog/u/47054/category/218257/rss</id><updated>2012-05-31T17:09:45Z</updated><generator>feed.cnblogs.com</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/dooom/category/218257.html"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/47054/category/218257/rss"/><entry><id>http://www.cnblogs.com/dooom/archive/2011/02/14/1954111.html</id><title type="text">对象行为模式--策略模式</title><summary type="text">这段时间在项目中接触到了Strategy策略模式，所以就学习了一下，做一个总结。 Strategy策略模式是一种对象行为模式。主要是应对：在软件构建过程中，某些对象使用的算法可能多种多样，经常发生变化。如果在对象内部实现这些算法，将会使对象变得异常复杂，甚至会造成性能上的负担。 GoF《设计模式》中说道：定义一系列算法，把它们一个个封装起来，并且使它们可以相互替换。该模式使得算法可独立于它们的客户变化。 Strategy模式的结构图如下： 从图中我们不难看出：Strategy模式实际上就是将算法一一封装起来，如图上的ConcreteStrategyA、ConcreteStrategyB、Con</summary><published>2011-02-14T02:36:00Z</published><updated>2011-02-14T02:36:00Z</updated><author><name>clound</name><uri>http://www.cnblogs.com/dooom/</uri></author><link rel="alternate" href="http://www.cnblogs.com/dooom/archive/2011/02/14/1954111.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/dooom/archive/2011/02/14/1954111.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/dooom/archive/2011/02/13/1953049.html</id><title type="text">结构型模式--Proxy代理模式</title><summary type="text">Proxy代理模式是一种结构型设计模式，主要解决的问题是：在直接访问对象时带来的问题，比如说：要访问的对象在远程的机器上。在面向对象系统中，有些对象由于某些原因（比如对象创建开销很大，或者某些操作需要安全控制，或者需要进程外的访问），直接访问会给使用者或者系统结构带来很多麻烦，我们可以在访问此对象时加上一个对此对象的访问层。如下图： 比如说C和A不在一个服务器上，A要频繁的调用C，我们可以在A上做一个代理类Proxy，把访问C的工作交给Proxy，这样对于A来说，就好像在直接访问C的对象。在对A的开发中我们可以把注意力完全放在业务的实现上。 GoF《设计模式》中说道：为其他对象提供一种代理以控</summary><published>2011-02-13T03:02:00Z</published><updated>2011-02-13T03:02:00Z</updated><author><name>clound</name><uri>http://www.cnblogs.com/dooom/</uri></author><link rel="alternate" href="http://www.cnblogs.com/dooom/archive/2011/02/13/1953049.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/dooom/archive/2011/02/13/1953049.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/dooom/archive/2011/02/13/1953040.html</id><title type="text">结构型--享元模式（Flyweight Pattern）</title><summary type="text">1、意图享元模式：运用共享技术有效地支持大量细粒度的对象2、核心思想 享元模式以共享的方式高效的支持大量的细粒度对象。享元模式能做到共享的关键是区分内蕴状态和外蕴状态。 内蕴状态存储在享元内部，不会随环境的改变而有所不同。外蕴状态是随环境的改变而改变的。外蕴状态不能影响内蕴状态，它们是相互独立的。 将可以共享的状态和不可以共享的状态从常规类中区分开来，将不可以共享的状态从类里剔除出去。 客户端不可以直接创建被共享的对象，而应当使用一个工厂对象负责创建被共享的对象。享元模式大幅度的降低内存中对象的数量。3、优缺点分析GOOD： （1）运用共享技术有效地支持大量细粒度的对象（对于C++来说就是共用</summary><published>2011-02-13T02:36:00Z</published><updated>2011-02-13T02:36:00Z</updated><author><name>clound</name><uri>http://www.cnblogs.com/dooom/</uri></author><link rel="alternate" href="http://www.cnblogs.com/dooom/archive/2011/02/13/1953040.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/dooom/archive/2011/02/13/1953040.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/dooom/archive/2011/02/11/1951517.html</id><title type="text">创建型模式--Builder 生成器模式</title><summary type="text">今天看到这篇介绍生成器模式的文章，觉得不错。原文在这Builder模式的缘起假设创建游戏中的一个房屋House设施，该房屋的构建由几个部分组成，且各个部分要富于变化。如果使用最直观的设计方法，每一个房屋部分的变化，都将导致房屋构建的重新修正&amp;hellip;&amp;hellip;（在这里，创建House，事先规定了是几个门、几个窗、几个墙壁，这些是相对稳定的。 而House中门、窗、墙壁是如何，比如是欧式风格的House就要相应的欧式风格的门、窗、墙壁等， 中国风格的House就要相应的风格的门、窗、墙壁等。这些是变化的。）动机（Motivation）在软件系统中，有时候面临着&amp;amp</summary><published>2011-02-11T09:22:00Z</published><updated>2011-02-11T09:22:00Z</updated><author><name>clound</name><uri>http://www.cnblogs.com/dooom/</uri></author><link rel="alternate" href="http://www.cnblogs.com/dooom/archive/2011/02/11/1951517.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/dooom/archive/2011/02/11/1951517.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/dooom/archive/2010/12/22/1914252.html</id><title type="text">创建型模式-工厂方法模式</title><summary type="text">转自：http://www.cnblogs.com/anlyren/archive/2008/01/26/factory_method.html#1899056工厂方法模式（Factory Method Pattern）介绍：在简单工厂模式中，我们提到，工厂方法模式是简单工厂模式的一个延伸，它属于Gof23中设计模式的创建型设计模式。它解决的仍然是软件设计中与创建对象有关的问题。它可以更好的处理客户的需求变化。引入我们继续来说"new"的问题，我们在简单工厂模式中，将实例化对象的工作推迟到了专门负责创建对象的工厂类中，这样，在我们事先预知的情况下，可以根据我们的需要动态创建</summary><published>2010-12-22T15:01:00Z</published><updated>2010-12-22T15:01:00Z</updated><author><name>clound</name><uri>http://www.cnblogs.com/dooom/</uri></author><link rel="alternate" href="http://www.cnblogs.com/dooom/archive/2010/12/22/1914252.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/dooom/archive/2010/12/22/1914252.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/dooom/archive/2010/12/22/1914240.html</id><title type="text">创建型模式-简单工厂模式（2）</title><summary type="text">转自：http://www.cnblogs.com/anlyren/archive/2008/01/25/simple_factory_pattern.html简单工厂模式（Simple Factory Pattern）介绍：简单工厂模式不能说是一个设计模式，说它是一种编程习惯可能更恰当些。因为它至少不是Gof23种设计模式之一。但它在实际的编程中经常被用到，而且思想也非常简单，可以说是工厂方法模式的一个引导，所以我想有必要把它作为第一个讲一下。引入：我们在编程的时候，每当"new"一个对象之后，这个对象就依赖于这个类了。如果在后期的维护过程中由于某些原因需要修改一下这个类，则唯一的做法就是打</summary><published>2010-12-22T14:52:00Z</published><updated>2010-12-22T14:52:00Z</updated><author><name>clound</name><uri>http://www.cnblogs.com/dooom/</uri></author><link rel="alternate" href="http://www.cnblogs.com/dooom/archive/2010/12/22/1914240.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/dooom/archive/2010/12/22/1914240.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/dooom/archive/2010/06/08/1754231.html</id><title type="text">创建型模式-单件模式（1）</title><summary type="text">单件模式特点： 1 :单件类只可有一个实例。 2 :单件类必须自己创建自己这惟一的实例。 3 :单件类必须给所有其他对象提供这一实例。结构： 如何实现：其实我们只需要把构造函数私有化，把new对象的过程进行控制就行了，具体代码如下：1publicclassSingleton2{3privatestaticSingletonuniqueInstance;//用一个静态变量来记录Singleton类的唯一实例45privateSingleton()//构造器必须私有6{7}89publicstaticSingletonInstance10{11get12{13if(null==uniqueIns</summary><published>2010-06-08T10:51:00Z</published><updated>2010-06-08T10:51:00Z</updated><author><name>clound</name><uri>http://www.cnblogs.com/dooom/</uri></author><link rel="alternate" href="http://www.cnblogs.com/dooom/archive/2010/06/08/1754231.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/dooom/archive/2010/06/08/1754231.html"/><content type="html"/></entry></feed>
