• 设计模式总结


    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

    封装调用,成一个对象。

  • 相关阅读:
    980不同路径III
    输入函数
    IDEA更新maven依赖包
    join()函数
    方差偏差困境
    np.bincount()函数
    72编辑距离
    741摘樱桃
    523连续的子数组和
    1306跳跃游戏III
  • 原文地址:https://www.cnblogs.com/shenfengok/p/6887791.html
Copyright © 2020-2023  润新知