zoukankan      html  css  js  c++  java
  • 设计模式总结

    1. Adapter,适配器,

    Wraps an object and provides a different interface to it.

    适配一个对象,然后提供一个别的接口

    2. Template method

    Subclasses decide how to implement steps in an algorithm.

    子类决定怎么实现算法步骤

    3. 工厂方法 Factory Method
    Subclasses decide which concrete classes to create.

    子类决定创建哪个具体类的对象

    4.单例模式 Singleton
    Ensures one and only object is created.

    保证只有一个对象创建

    5. 策略模式
    Encapsulates interchangeable behaviors and uses delegation to decide which one to use.

    封装可变的行为,用一个委托去决定用哪个

    6. 组合模式Composite
    Clients treat collections of objects and individual objects uniformly.

    调用端用同一的方式对待一个对象和一组对象。

    7. 状态模式State
    Encapsulates state-based behaviors and uses delegation to switch between behaviors.

    包装跟状态有关的行为,并且根据状态切换。

    8. 迭代器模式 Iterator

    Provides a way to traverse a collection of objects without exposing its implementation.

    提供一个访问集合的方式,而不用了解他们具体的形式

    9. 外观模式Facade
    Simplifies the interface of a set of classes.

    为一对类提供一个简化接口

    10. 装饰者模式
    Wraps an object to provide new behavior.

    每次包装一个对象,提供新的行为。

    11. 抽象工厂
    Allows a client to create families of objects without specifying their concrete classes.

    创建一组相关的类,这组类息息相关。

    12. 观察者模式Observer
    Allows objects to be notified when state changes.

    每次状态改变,通知其他对象

    13.代理模式Porxy

    包装一个对象,控制对他的访问
    Wraps an object to control access to it.

    14. 命令模式,Command
    Encapsulates a request as an object

    封装调用,成一个对象。

  • 相关阅读:
    返回数组指针的函数形式
    zoj 2676 网络流+01分数规划
    2013 南京理工大学邀请赛B题
    poj 2553 强连通分支与缩点
    poj 2186 强连通分支 和 spfa
    poj 3352 边连通分量
    poj 3177 边连通分量
    poj 2942 点的双连通分量
    poj 2492 并查集
    poj 1523 求割点
  • 原文地址:https://www.cnblogs.com/shenfengok/p/6887791.html
Copyright © 2011-2022 走看看