随笔分类 - 设计模式
摘要:一、定义 建造者模式(Builder Pattern)也叫生成器模式,其定义如下: Separate the construction fo a complex object from its representation so that the same comstruction process
阅读全文
摘要:一、定义 模板方法模式(Template Method Pattern)的定义如下: Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method le
阅读全文
摘要:一、定义 抽象工厂模式(Abstract Factory Pattern)是一种比较常见的模式,其定义如下: Provide an interface for creating families of related or dependent objects without specifying t
阅读全文
摘要:一、定义 Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation
阅读全文
摘要:一、定义 单例模式(Singleton Pattern)是一个比较简单的模式,定义如下: Ensure a class has only one instance, and provide a global point of access to it.(确保某一个类职业一个实例,而且自行实例化并向整
阅读全文
摘要:一、单一职责原则 Single Responsibility Principle,简称SRP。 单一职责原则的定义是:应该有且仅有一个原因引起类的变更。 二、里氏替换原则 Liskov Substitution Principle,LSP 定义1:如果每一个类型为S的对象o1,都有类型为T的对象o2
阅读全文

浙公网安备 33010602011771号