您的位置:首页 > 其它

设计模式概述-学习笔记

2017-09-06 13:02 225 查看
设计模式

刘伟 http://blog.csdn.net/lovelion

在线书籍 https://gof.quanke.name/

模式是在特定环境下人们解决某类重复出现问题的一套成功或有效的解决方案

A pattern is a successful or efficient solution to a recurring problem within a context

软件模式是在软件开发中某些可重现问题的一些有效解决方法,软件模式的基础结构主要由四部分构成,包括:问题描述【待解决的问题是什么】、前提条件【在何种环境或约束条件下使用】、解法【如何解决】和效果【有哪些优缺点】



图1-1 软件模式基本结构

设计模式的一般定义如下: 设计模式(Design Pattern)是一套被反复使用、多数人知晓的、经过分类编目的、代码设计经验的总结,使用设计模式是为了可重用代码、让代码更容易被他人理解并且保证代码可靠性。

根据它们的用途,设计模式可分为创建型(Creational),结构型(Structural)和行为型(Behavioral)三种,其中创建型模式主要用于描述如何创建对象,结构型模式主要用于描述如何实现类或对象的组合,行为型模式主要用于描述类或对象怎样交互以及怎样分配职责

表1 常用设计模式一览表

类型模式名称学习难度使用频率
创建型模式 Creational Pattern单例模式 Singleton Pattern★☆☆☆☆★★★★☆
创建型模式 Creational Pattern简单工厂模式 Simple Factory Pattern★★☆☆☆★★★☆☆
创建型模式 Creational Pattern工厂方法模式 Factory Method Pattern★★☆☆☆★★★★★
创建型模式 Creational Pattern抽象工厂模式 Abstract Factory Pattern★★★★☆★★★★★
创建型模式 Creational Pattern原型模式 Prototype Pattern★★★☆☆★★★☆☆
创建型模式 Creational Pattern建造者模式 Builder Pattern★★★★☆★★☆☆☆
结构型模式 Structural Pattern适配器模式 Adapter Pattern★★☆☆☆★★★★☆
结构型模式 Structural Pattern桥接模式 Bridge Pattern★★★☆☆★★★☆☆
结构型模式 Structural Pattern组合模式 Composite Pattern★★★☆☆★★★★☆
结构型模式 Structural Pattern装饰模式 Decorator Pattern★★★☆☆★★★☆☆
结构型模式 Structural Pattern外观模式 Façade Pattern★☆☆☆☆★★★★★
结构型模式 Structural Pattern享元模式 Flyweight Pattern★★★★☆
结构型模式 Structural Pattern代理模式 Proxy Pattern★★★☆☆★★★★☆
行为型模式 Behavioral Pattern职责链模式 Chain of Responsibility Pattern★★★☆☆★★☆☆☆
行为型模式 Behavioral Pattern命令模式 Command Pattern★★★☆☆★★★★☆
行为型模式 Behavioral Pattern解释器模式 Interpreter Pattern★★★★★★☆☆☆☆
行为型模式 Behavioral Pattern迭代器模式 Iterator Pattern★★★☆☆★★★★★
行为型模式 Behavioral Pattern中介者模式 Mediator Pattern★★★☆☆★★☆☆☆
行为型模式 Behavioral Pattern备忘录模式 Memento Pattern★★☆☆☆★★☆☆☆
行为型模式 Behavioral Pattern观察者模式 Observer Pattern★★★☆☆★★★★★
行为型模式 Behavioral Pattern状态模式 State Pattern★★★☆☆★★★☆☆
行为型模式 Behavioral Pattern策略模式 Strategy Pattern★☆☆☆☆★★★★☆
行为型模式 Behavioral Pattern模板方法模式 Template Method Pattern★★☆☆☆★★★☆☆
行为型模式 Behavioral Pattern访问者模式 Visitor Pattern★★★★☆★☆☆☆☆
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: