Giter Site home page Giter Site logo

javadesignpattern's Introduction

JavaDesignPattern

设计模式大体上分为三大类

创建型模式(5种):工厂方法模式(1/5),抽象工厂模式(2/5),单例模式(3/5),建造者模式(4/5),原型模式(5/5)。

结构型模式(7种):适配器模式(1/7),装饰器模式(2/7),代理模式(3/7),外观模式(4/7),桥接模式(5/7),组合模式(6/7),享元模式(7/7)。

行为型模式(11种):策略模式(1/11)、模板方法模式(2/11)、观察者模式(3/11)、迭代子模式(4/11)、责任链模式(5/11)、命令模式(6/11)、备忘录模式(7/11)、状态模式(8/11)、访问者模式(9/11)、中介者模式(10/11)、解释器模式(11/11)。

设计模式遵循的原则有6个:

1、开闭原则(Open Close Principle)

  对扩展开放,对修改关闭。

2、里氏代换原则(Liskov Substitution Principle)

  只有当衍生类可以替换掉基类,软件单位的功能不受到影响时,基类才能真正被复用,而衍生类也能够在基类的基础上增加新的行为。

3、依赖倒转原则(Dependence Inversion Principle)

  这个是开闭原则的基础,对接口编程,依赖于抽象而不依赖于具体。

4、接口隔离原则(Interface Segregation Principle)

  使用多个隔离的借口来降低耦合度。

5、迪米特法则(最少知道原则)(Demeter Principle)

  一个实体应当尽量少的与其他实体之间发生相互作用,使得系统功能模块相对独立。

6、合成复用原则(Composite Reuse Principle)

  原则是尽量使用合成/聚合的方式,而不是使用继承。继承实际上破坏了类的封装性,超类的方法可能会被子类修改。

javadesignpattern's People

Contributors

fanerwei222 avatar

Watchers

James Cloos avatar  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.