Giter VIP home page Giter VIP logo

mydesign's Introduction

java的设计模式大体上分为三大类:
    创建型模式(5种):工厂方法模式,抽象工厂模式,单例模式,建造者模式,原型模式。
        软件设计的过程是循序渐进的,一步一步来的。在软件设计中对象的创建和对象的使用是分开的,因为对象的创建会消耗掉系统的很多资源,
        所以单独对对象的创建进行研究,从而能够高效地创建对象就是创建型模式要探讨的问题。
    结构型模式(7种):适配器模式,装饰器模式,代理模式,外观模式,桥接模式,组合模式,享元模式。
        在解决了对象的创建问题之后,对象的组成以及对象之间的依赖关系就成了开发人员关注的焦点,因为如何设计对象的结构、
        继承和依赖关系会影响到后续程序的维护性、代码的健壮性、耦合性等。
    行为型模式(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)
      原则是尽量使用合成/聚合的方式,而不是使用继承。继承实际上破坏了类的封装性,超类的方法可能会被子类修改。

mydesign's People

Contributors

huademo avatar

Stargazers

 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.