小杭的学习设计模式笔记

来源:互联网 发布:做网页的软件 知乎 编辑:程序博客网 时间:2024/05/12 08:03

小杭的学习设计模式笔记

最近去了解了一下设计模式的东东,参考了一些博文:
主要的有:两位大神的博客
http://blog.csdn.net/zhengzhb/article/category/926691
http://www.cnblogs.com/itTeacher/category/428818.html

看完感觉没啥用,但是对编程都了解了写!╮(╯_╰)╭


好多模式,先都列出来:

一共23种设计模式!

按照目的来分,设计模式可以分为创建型模式、结构型模式和行为型模式。
创建型模式用来处理对象的创建过程;结构型模式用来处理类或者对象的组合;行为型模式用来对类或对象怎样交互和怎样分配职责进行描述。

创建型模式用来处理对象的创建过程,主要包含以下5种设计模式:
 工厂方法模式(Factory Method Pattern)
 抽象工厂模式(Abstract Factory Pattern)
 建造者模式(Builder Pattern)
 原型模式(Prototype Pattern)
 单例模式(Singleton Pattern)

结构型模式用来处理类或者对象的组合,主要包含以下7种设计模式:
 适配器模式(Adapter Pattern)
 桥接模式(Bridge Pattern)
 组合模式(Composite Pattern)
 装饰者模式(Decorator Pattern)
 外观模式(Facade Pattern)
 享元模式(Flyweight Pattern)
 代理模式(Proxy Pattern)

行为型模式用来对类或对象怎样交互和怎样分配职责进行描述,主要包含以下11种设计模式:
 责任链模式(Chain of Responsibility Pattern)
 命令模式(Command Pattern)
 解释器模式(Interpreter Pattern)
 迭代器模式(Iterator Pattern)
 中介者模式(Mediator Pattern)
 备忘录模式(Memento Pattern)
 观察者模式(Observer Pattern)
 状态模式(State Pattern)
 策略模式(Strategy Pattern)
 模板方法模式(Template Method Pattern)
 访问者模式(Visitor Pattern)

设计模式六大原则【都是copy的这个原则】
单一职责原则(Single Responsibility Principle)【类功能】
里氏替换原则(Liskov Substitution Principle)【类继承】
依赖倒置原则(Dependence Inversion Principle)【接口,抽象】【解耦】
接口隔离原则(Interface Segregation Principle)【独立,最小接口,精简单一】
迪米特法则(Law Of Demeter)【类的内聚低耦合】
开闭原则(Open Close Principle)【对扩展开放,对修改关闭】

0 0
原创粉丝点击