Giter Site home page Giter Site logo

designpatten's Introduction

Design Patten

Tool Box

OO基础

  • 抽象
  • 封装
  • 多态
  • 继承

OO原则

  • 开放-关闭原则:类应该对拓展开放,对修改关闭
  • 封装变化
  • 多用组合、少用继承
  • 针对接口编程,不针对实现编程
  • 为交互对象之间的松耦合设计而努力

依赖倒置 Dependency Inversion Principle

img.png 在类A的内部去实例化类B,那么两者之间会出现较高的耦合

要依赖抽象,不要依赖具体类

  • 变量不可以持有具体类的引用
  • 不要让类派生自具体类

OO模式

策略模式

观察者模式

装饰者模式

designpatten's People

Watchers

Robin Wang 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.