Summary of six principles and one rule of java object-oriented

1. Single responsibility principle: one kind only does what it should do.

2. Richter substitution principle: a subclass must be able to replace the base class (parent class), otherwise it should not be designed as its subclass.

3. Dependency switching principle: design should rely on abstraction rather than materialization.

4. Interface isolation principle: the interface shall be small and special, not large and complete.

5. Opening and closing principle: a software entity such as class, module and function should be open to extension and closed to modification.

6. Reuse Principle of combination / aggregation: use combination and aggregation as much as possible and use less inheritance relationship to achieve the reuse principle.

7. Demeter's Law: low coupling, high cohesion.

The above is the whole content of this article. I hope the content of this article can bring some help to your study or work. At the same time, I also hope to support a lot of programming tips!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>