In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you what AJPFX object-oriented design principles are, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Design principles of object-oriented thought
A. the principle of single responsibility
In fact, developers often say that "high cohesion, low coupling"
In other words, each class should have only one responsibility, only one function can be provided externally, and there should be only one reason for the class change. In design patterns, all design patterns follow this principle.
B. the principle of opening and closing
The core idea is that an object is open to extension and closed to modification.
In fact, the open-close principle means that changes to the class are made by adding code, not by modifying existing code.
That is to say, once software developers have written code that can run, they should not change it, but to ensure that it can run all the time. How can they do this? This requires the help of abstraction and polymorphism, that is, abstracting the content that may change, so that the abstract part is relatively stable, while the concrete implementation can be changed and extended.
C, Richter substitution principle
Core idea: wherever the parent class appears, it can be replaced by its subclass.
In fact, it means that objects in the same inheritance system should have common behavioral characteristics.
D. Dependency injection principle
Core idea: rely on abstraction, not on concrete implementation.
In fact, in an application, if all classes use or depend on other classes, they should rely on the abstract classes of these other classes, rather than the concrete classes of these other classes. In order to implement this principle, we are required to program for abstract classes or interfaces, not for specific implementations.
E. the principle of interface separation
Core idea: programs should not be forced to rely on methods they do not need to use.
In fact, it means that an interface does not need to provide too much behavior, an interface should only provide an external function, and all operations should not be encapsulated into one interface.
F and Dimitt principle
Core idea: an object should know as little as possible about other objects
In fact, it means to reduce the coupling between objects and improve the maintainability of the system. The modules should be programmed only through the interface, regardless of the internal working principle of the modules, which can minimize the coupling of each module and promote the reuse of the software.
What are the object-oriented design principles of AJPFX? have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.