Neil 啃设计模式(0x05)模板模式

2020-02-26
阅读 3 分钟
1.1k
Define the skeleton of an algorithm in an operation,deferring some steps to subclasses.Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.(定义一个操作中的算法的框架,而将一些步骤延迟到子类中。使得子类可以不改变一个算法的结构即可重定...

Neil 啃设计模式(0x04)建造者模式

2020-02-25
阅读 6 分钟
1.3k
Separate the construction of a complex object from its representation so that the same construction process can create different representations.(将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示。)《设计模式之禅》

Neil 啃设计模式(0x3)抽象工厂模式

2020-02-20
阅读 5 分钟
1.2k
Provide an interface for creating families of related or dependent objects without specifying their concrete classes.(为创建一组相关或相互依赖的对象提供一个接口,而且无须指定它们的具体类。)《设计模式之禅》

Neil 啃设计模式(0x02)工厂模式

2020-02-19
阅读 2 分钟
1.3k
Define an interface for creating an object,but let subclasses decide which class to instantiate.Factory Method lets a class defer instantiation to subclasses.(定义一个用于创建对象的接口,让子类决定实例化哪一个类。工厂方法使一个类的实例化延迟到其子类。)对于python这种运行时判断类型的脚本语言来说...

Neil啃设计模式(0x01)单例模式

2020-02-14
阅读 4 分钟
1.3k
“单例模式(Singleton Pattern)是一个比较简单的模式,其定义如下:Ensure a class has only one instance, and provide a global point of access to it.(确保某一个类只有一个实例,而且自行实例化并向整个系统提供这个实例。)”Excerpt From: 秦小波 著. “设计模式之禅(第 2 版)(华章原创精品).” iBooks.