Giter Site home page Giter Site logo

design-patterns's People

Contributors

fxleyu avatar

Watchers

 avatar  avatar

design-patterns's Issues

[学习] 软件工程中的SOLID

在 程序设计领域, SOLID单一功能、开闭原则、里氏替换、接口隔离以及依赖反转) 是由罗伯特·C·马丁在21世纪早期 引入的记忆术首字母缩略字,指代了面向对象编程和面向对象设计的五个基本原则。

具体内容如下:

  • S 单一功能原则 认为对象应该仅具有一种单一功能的概念。
  • O 开闭原则 认为“软件体应该是对于扩展开放的,但是对于修改封闭的”的概念。
  • L 单一功能原则 认为“程序中的对象应该是可以在不改变程序正确性的前提下被它的子类所替换的”的概念。
  • I 接口隔离原则 认为“多个特定客户端接口要好于一个宽泛用途的接口” 的概念。
  • D 依赖反转原则 认为一个方法应该遵从“依赖于抽象而不是一个实例”[5] 的概念。

[模式] 职责链(Chain Of Responsibility)模式

职责链(Chain Of Responsibility)—— 对象行为型模式

本 Issue 内容来自于《设计模式》第五章第一节内容。(P147)

1 意图

使多个对象都有机会处理请求,从而避免请求的发送者和接收者之间的耦合关系。将这些对象连成一条链,并沿着这条链传递该请求,直到有一个对象处理它为止。

2 动机

[模式] 策略模式

策略模式定义了算法族,分别封装起来,让 它们之间可以相互替换,此模式让算法的变化独立于使用算法的客户。

[模式] 观察者模式

观察者模式定义了对象之间的一对多依赖,这样一来,当一个对象改变状态时,它的所有依赖者都会收到通知并自动更新。

[模式] 外观(FACADE)模式

外观(FACADE) —— 对象结构型模式

1 意图

为子系统中的一组接口提供一个一致的界面,Facade 模式定义了一个高层接口,这个接口使得这一子系统更容易使用。

[模式] 工厂方法模式

工厂方法模式定义了一个创建对象的接口,但由子类决定要实例化的类是哪一个。工厂方法把类实例化推迟到子类。

[模式] 装饰者模式

装饰者模式动态地将责任附加到对象上。若要扩展功能,装饰者提供了比继承更有弹性的替代方案。

[模式] 命令模式

命令模式将“请求”封装成对象,以便使用不同的请求、队列或者日志来参数化其他对象。命令模式也支持可撤销的操作。

[模式] 单件模式

单件模式确保了一个类只有一个实例,并提供一个全局访问点。

[模式] 抽象工厂模式

抽象工厂模式提供了一个接口,用于创建相关或依赖对象的家族,而不需要明确指定具体类。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.