Code Monkey home page Code Monkey logo

java-design's Introduction

java-design

《大话设计模式》代码Java版本

设计模式就是前人总结的从设计的角度解决一些问题的套路。


读书笔记


设计模式6大原则

1、开闭原则(Open Close Principle)

对扩展开放,对修改关闭

在程序需要进行拓展的时候,不能去修改原有的代码,实现热插拔效果。

多使用接口和抽象类。

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

任何基类(接口或者父类)可以出现的地方,子类一定可以出现。

这个原则是对开闭原则的补充。

实现开闭原则的关键步骤是抽象化

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

针对接口编程,依赖于抽象而不依赖于具体。

这个原则是开闭原则的基础。

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

使用多个隔离的接口,比使用单个接口要好。更好地降低耦合度。

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

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

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

尽量使用合成/聚合的方式,而不是使用继承。

设计模式分类

简单工厂模式

设计模式其他有价值的参考资料

java-design's People

Contributors

yeyouluo avatar

Stargazers

Puma avatar Gorsky avatar  avatar tou Shi avatar  avatar  avatar jiangfeng avatar  avatar

Watchers

James Cloos avatar

Forkers

iweisi

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.