随笔分类 - 设计模式
摘要:抽象工厂代码示例 为创建一组相关或相互依赖的对象提供一个接口,而且无需指定它们的具体类。 产品族需要扩展的不适合抽象工厂,即在抽象工厂中在加一个createXXX(); public class AbstractFactory { public static void main(String[] a
阅读全文
摘要:设计模式总结 设计模式分为三大类:创建型模式、结构型模式、行为模式 一、创建型模式 1.工厂方法 Factory Method 2.抽象工厂 Abstract Factory 3.生成器 Builder 4.原型 Prototype 5.单例 Singleleton 二、结构型模式 1.适配器 Ad
阅读全文
摘要:责任链模式 定义:Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving obj
阅读全文