Principles of composition/aggregation reuse
The Composite/Aggregate Reuse Principle (CARP) is generally called the Composite Reuse Principle (CRP), which is defined as: try to use composite/aggregate instead of inheriting to achieve the purpose of reuse. The principle of composition/aggregation reuse is to use some existing objects in a new object to make it a part of the new object; the new object achieves the purpose of reusing existing functions by delegating to these objects held internally. Instead of getting existing functions th...
1. Salt
The application of Salting in HBase is to assign a random character to each rowkey prefix, so that the data is scattered in multiple different regions to achieve a balanced load. If the table region in HBase is distinguished according to the prefix of each letter, let's compare the changes before and after adding salt to the rowkey. First, we give a set of rowkeys before salt: rk001 rk002 rk003 According to the partition, the above rowkey is in the same region. Below we add salt to the above ...
Significance of the Single Responsibility Principle
The single responsibility principle tells us: a class cannot do too many things. In a software system, the more responsibilities a class (a module, or a method) assumes, the lower the possibility of it being reused. A very typical example is the universal class. In fact, we can tell the truth: any conventional MVC project, in extreme cases, can use one class (or even one method) to complete all functions. But doing so will cause serious coupling and even affect the whole body. A class underta...
https://rss3.bio/0x8fC645e6a176F07395B8f44196d1443772FE9d57
Principles of composition/aggregation reuse
The Composite/Aggregate Reuse Principle (CARP) is generally called the Composite Reuse Principle (CRP), which is defined as: try to use composite/aggregate instead of inheriting to achieve the purpose of reuse. The principle of composition/aggregation reuse is to use some existing objects in a new object to make it a part of the new object; the new object achieves the purpose of reusing existing functions by delegating to these objects held internally. Instead of getting existing functions th...
1. Salt
The application of Salting in HBase is to assign a random character to each rowkey prefix, so that the data is scattered in multiple different regions to achieve a balanced load. If the table region in HBase is distinguished according to the prefix of each letter, let's compare the changes before and after adding salt to the rowkey. First, we give a set of rowkeys before salt: rk001 rk002 rk003 According to the partition, the above rowkey is in the same region. Below we add salt to the above ...
Significance of the Single Responsibility Principle
The single responsibility principle tells us: a class cannot do too many things. In a software system, the more responsibilities a class (a module, or a method) assumes, the lower the possibility of it being reused. A very typical example is the universal class. In fact, we can tell the truth: any conventional MVC project, in extreme cases, can use one class (or even one method) to complete all functions. But doing so will cause serious coupling and even affect the whole body. A class underta...
Share Dialog
Share Dialog
https://rss3.bio/0x8fC645e6a176F07395B8f44196d1443772FE9d57

Subscribe to rojeck

Subscribe to rojeck
<100 subscribers
<100 subscribers
The definition of Dependency Inversion Principle (DIP): Programs must rely on abstract interfaces, not specific implementations. Simply put, it is required to program the abstraction, not the implementation, which reduces the coupling between the client and the implementation module.
The meaning of relying on the principle of reversal
The principle of dependency inversion requires us to refer to high-level abstraction classes as much as possible when passing parameters in program code or in association relationships, that is, use interfaces and abstract classes for variable type declaration, parameter type declaration, method return type declaration, and data type Conversion, etc., instead of using specific classes to do these things. In order to ensure the application of this principle, a concrete class should only implement the methods declared in the interface or abstract class, and should not provide redundant methods, otherwise it will not be able to call the new methods added in the subclass. After the introduction of the abstraction layer, the system will have good flexibility. Try to use the abstraction layer for programming in the program, and write the specific classes in the configuration file. In this way, if the system behavior changes, only the abstraction layer is required. Expand and modify the configuration file without modifying the source code of the original system, and expand the functions of the system without modification to meet the requirements of the opening and closing principles.
The definition of Dependency Inversion Principle (DIP): Programs must rely on abstract interfaces, not specific implementations. Simply put, it is required to program the abstraction, not the implementation, which reduces the coupling between the client and the implementation module.
The meaning of relying on the principle of reversal
The principle of dependency inversion requires us to refer to high-level abstraction classes as much as possible when passing parameters in program code or in association relationships, that is, use interfaces and abstract classes for variable type declaration, parameter type declaration, method return type declaration, and data type Conversion, etc., instead of using specific classes to do these things. In order to ensure the application of this principle, a concrete class should only implement the methods declared in the interface or abstract class, and should not provide redundant methods, otherwise it will not be able to call the new methods added in the subclass. After the introduction of the abstraction layer, the system will have good flexibility. Try to use the abstraction layer for programming in the program, and write the specific classes in the configuration file. In this way, if the system behavior changes, only the abstraction layer is required. Expand and modify the configuration file without modifying the source code of the original system, and expand the functions of the system without modification to meet the requirements of the opening and closing principles.
No activity yet