The software design process involves several types of source code-related roles: 1. User; 2. Modifier
1. Closed principle. Things that users do not need to know are closed. One can reduce irrelevant information reading, and the other can reduce misuse, increase code coupling, and increase the difficulty of code modification in the future.
2. abstract interface principles. The user references abstract interfaces, which reduces the difficulty of modifying the code.
<P $1 $2 $3 $4 $5 $6>
There are usually not many things in principle, but the specific measures are quite extensive.
How to implement the principle of closures?
First, you need to know what is closed and how close it is. Many languages can be closed in multiple layers, for example: 1. within the project; 2. file; 3. classes can be public, inherited, and private. 4. class Members are public, inherited, and private. The principle of how to implement the closure is that, within a certain range, you do not want to or do not want to make public, or you cannot decide whether or not to make public, all remain closed.
How to Implement the abstract interface principle?
We have discussed the concept of closures. The so-called interface is actually the content published within a certain range. As long as it is made public, the user may use it. If you want to modify it, you may have to change the interface. Therefore, to implement the abstract interface principle, we must first implement the closed principle. Only the closed interfaces are closed, and only enough interfaces are provided to users (such as through interfaces and abstract classes). This implements the abstract interface principle.
<P $1 $2 $3 $4 $5 $6>
To be continued ~