Neil 啃设计模式(0x08)装饰器模式

2020-04-13
阅读 5 分钟
1.5k
“Attach additional responsibilities to an object dynamically keeping the same interface.Decorators provide a flexible alternative to subclassing for extending functionality.(动态地给一个对象添加一些额外的职责。就增加功能来说,装饰模式相比生成子类更为灵活。)”

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.