Giter Club home page Giter Club logo

go_design_patterns's Introduction

设计模式七大原则

开闭原则: 对扩展开放,对修改关闭

理解: 当新增某一功能时,应该与原有的代码逻辑没有关系,也就是不需要修改原有的代码

里式替换原则:父类出现的任何地方,都可以用子类替换

理解:面向对象继承的体现,子类继承父类,子类就拥有父类的一切行为和属性

单一职责原则:一个类有且仅有一个引起它变化的原因,否则这个类就需要拆分

依赖倒置原则:抽象不依赖于具象,具象依赖抽象

理解:抽象类或者父类不关心继承类的实现,但是继承类要实现抽象类的约定

接口隔离原则:客户端不应该去依赖一个它不使用的接口(一个类对另一个类的依赖,应该在最小的接口上)

理解:某一功能接口的定义或者暴露,应该是尽可能少和紧密相关的

(迪米特原则)最少知道原则:高内聚

理解:后面这两个原则,暂时不做解释,虽有点的理解

合成复用原则: 理解:这个原则是说用组合的方式而不是继承的方式复用,但是我觉得要是具体场景,原则性不是很强

相关说明url: https://www.runoob.com/design-pattern/strategy-pattern.html

go_design_patterns's People

Contributors

xiet16 avatar

Watchers

 avatar

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.