设计模式概述-学习笔记
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 常用设计模式一览表
刘伟 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 | ★★★★☆ | ★☆☆☆☆ |
相关文章推荐
- 黑马程序员_学习笔记:3) 面向对象1:概述、封装、this、static、单例设计模式
- 设计模式学习笔记--设计模式概述
- C++学习笔记(二十五)设计模式概述
- 设计模式学习笔记:概述
- 设计模式之学习笔记1-----设计原则
- java 设计模式学习笔记十五 strategy 策略设计模式
- 设计模式学习笔记-装饰模式
- [学习笔记]设计模式[4]-{单件模式}
- 设计模式:状态模式(学习笔记)
- 设计模式学习笔记之Singleton模式
- 设计模式学习笔记(一):策略模式
- 设计模式学习笔记---代理模式Proxy(Java版)
- FlyWeight模式——设计模式学习笔记
- 《Head First 设计模式》学习笔记
- 设计模式C++学习笔记之十二(Command命令模式)
- 设计模式学习笔记(四)——Builder生成器模式
- 设计模式:装饰者模式(学习笔记)
- java/android 设计模式学习笔记(13)---享元模式
- 【笔记】【转载】JohnConnor设计模式笔记(一) 学习设计模式之前你必须掌握的-看懂UML类图
- 设计模式学习笔记(十四)——创建型模式(Creational patterns)总结