摘要: 定义: Define the skeleton of algorithm in an operation , deferring some steps to subclass. Template method lets subclasses redefine certain steps of a... 阅读全文
posted @ 2015-02-12 17:01 roscee 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 定义:Defined an interface for creating an object,but let subclasses decide which class to instantiate.Factory Method let a class defer instantiation to ... 阅读全文
posted @ 2015-02-12 14:04 roscee 阅读(192) 评论(0) 推荐(0) 编辑
摘要: package dmode.singleton;import java.util.Random;/** * 类描述: 单例模式 * 单例定义:ensure a class has only one instence,and provide a global point of access to i... 阅读全文
posted @ 2015-02-12 13:02 roscee 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 一:单一职责原则(single Responsibility Principle) 接口尽量做到职责的单一性,类可以灵活设计,通过实现不同的接口来达到目的二:里氏替换原则 父类出现的地方,子类都可以出现。增强代码健壮性,版本升级时,即使增加子类,原有子类不受影响。每一个子类是一个业务实体,通过父... 阅读全文
posted @ 2015-02-12 10:03 roscee 阅读(266) 评论(0) 推荐(0) 编辑