摘要: 一、基本概念 备忘录模式(Memento Pattern)提供了一种弥补真实世界缺陷的方法,让“后悔药”在程序的世界中真实可行,其定义如下:Without violating encapsulation,capture and externalize an o... 阅读全文
posted @ 2020-06-13 15:25 ${简简单单} 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 一、基本概念 中介者模式的定义为:Define an object that encapsulates how a set of objects interact.Mediator promotesloose coupling by keeping objec... 阅读全文
posted @ 2020-06-12 14:31 ${简简单单} 阅读(63) 评论(0) 推荐(0) 编辑
摘要: 一、基本概念 迭代器模式(Iterator Pattern)目前已经是一个没落的模式,基本上没人会单独写一个迭代器,除非是产品性质的开发,其定义如下:Provide a way to access the elements of an aggregate ob... 阅读全文
posted @ 2020-06-11 09:33 ${简简单单} 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 一、基本概念 解释器模式(Interpreter Pattern)是一种按照规定语法进行解析的方案,在现在项目中使用较少,其定义如下:Given a language, define a representation for its grammar along... 阅读全文
posted @ 2020-06-09 10:14 ${简简单单} 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 一、基本概念 命令模式是一个高内聚的模式,其定义为:Encapsulate a request as an object,thereby letting youparameterize clients with different requests,queue... 阅读全文
posted @ 2020-06-08 10:40 ${简简单单} 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 一、基本概念 责任链模式定义如下:Avoid coupling the sender of a request to its receiver by giving more than one object a chance tohandle the reque... 阅读全文
posted @ 2020-06-05 11:46 ${简简单单} 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 一、基本概念 单例模式(Singleton Pattern)是一个比较简单的模式,其定义如下:Ensure a class has only one instance, and provide a global point of access to it.(确... 阅读全文
posted @ 2020-06-04 11:35 ${简简单单} 阅读(32) 评论(0) 推荐(0) 编辑
摘要: 一、基本概念 原型模式(Prototype Pattern)的简单程度仅次于单例模式和迭代器模式。正是由于简单,使用的场景才非常地多,其定义如下:Specify the kinds of objects to create using a prototypic... 阅读全文
posted @ 2020-06-03 11:27 ${简简单单} 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 一、基本概念 工厂方法模式使用的频率非常高,在我们日常的开发中总能见到它的身影。其定义为:Define an interface for creating an object,but let subclasses decide which class to i... 阅读全文
posted @ 2020-06-02 11:27 ${简简单单} 阅读(26) 评论(0) 推荐(0) 编辑
摘要: 目录 一、基本概念 二、通俗解释 三、建造者模式详解 1.造车的例子 2.建造者模式的结构 3.建造者模式的优点 4.使用场景 5.注意事项 四、建造者模式的扩展和最佳实践 建造者模式的扩展 最佳实践 一、基本概念 建造者模式(Builder Pattern)... 阅读全文
posted @ 2020-05-29 11:00 ${简简单单} 阅读(38) 评论(0) 推荐(0) 编辑