Quoted by Baidu know:
1) open-close Principle (OCP), open-close principle,
It is about the design to have good support for the extension, and the changes to be strictly limited. This is the most important and most abstract principle, and basically what we call reusable software is developed based on this principle. Other principles also provide a path to its implementation.
2) Liskov substituition Principle (LSP), the Richter replacement principle ,
very strict principle, the rule is "the subclass must be able to replace the base class, otherwise it should not be designed as a subclass." In other words, subclasses can only extend the base class, not hide or overwrite the base class.
3) Dependence inversion Principle (DIP), dependency inversion principle ,
"design relies on abstraction rather than materialization." In other words, when designing, we need to think in abstractions, rather than start dividing what classes I need from the first, because these are specific. What good does it do? People's thinking itself is actually very abstract, we analyze the problem is not a moment to consider the details, but very abstract the whole problem is conceived out, so oriented to abstract design is in line with human thinking. In addition, this principle will be well supported by the OCP, and the abstraction-oriented design allows us to not rely too much on implementation, so that the extension becomes possible, and this principle is the cornerstone of another article, design by contract.
4) Interface segregation Principle (ISP), "breaking large interfaces into multiple small interfaces", interface Isolation principle
The benefits are obvious, I do not know if there is any need to continue to describe, in order to save space, in fact, I have only a small summary of these principles, if there is a need for more in-depth understanding of the recommended "Java and Mode," a masterpiece of MS MVP! ^_^
5) Composition/aggregation Reuse Principle (CARP), designers should first consider the composite/aggregation, rather than inheritance (because it is very intuitive, the first impression is "Oh, this is oo ah").
This is the so-called "Favor composition Over Inheritance", in practice, composite/aggregation will bring greater benefits than inheritance, so it should be given priority.
6) Law of Demeter or Least knowlegde Principle (LoD or LKP), Dimitri rule or least-knowledge principle,
This principle was first formally applied in the Demeter system, so it is defined as the Dimitri law. It says that "one object should be as little as possible to understand other objects." This is another law about how to loosely couple (loosely-coupled).
Java object-oriented six principles