Software design principles : The principle of software design is very helpful to improve the quality of software design .
Abstraction is the neglect of aspects of a subject that are not relevant to the current goal , In order to pay more attention to the aspects related to the current goal . Process abstraction and data abstraction are two main methods of abstraction .
Modularity refers to the decomposition of a software to be developed into several small and simple parts —— modular , Each module can be developed independently , test , Finally, it is assembled into complete software . It's a complex problem “ divide and rule ” Principle of .
Modules are data structures and program codes that perform a specific task . A module has its external and internal characteristics .
◆ Information concealment
Information concealment is the rule used in developing the overall program structure , To conceal or encapsulate the components of each program in a single design module
, Define each module with as little internal processing as possible . The principle of information concealment to improve the modifiability of software , Testability and portability play an important role .
◆ Module independent
Module independence means that each module completes a relatively independent sub function , And the connection with other modules is simple . There are two measures to measure module independence ： Coupling and Cohesion .
Coupling refers to the closeness of connection between modules . The higher the coupling degree, the worse the independence of the module .
According to the coupling degree from low to high, there are 7 Coupling mode .
Indirect coupling （ Independent operation ）
Data coupling （ Transfer simple data with parameter table ）
Tag coupling （ Transfer a data structure or part of it ）
Control coupling （ The information transmitted includes the information of the control module ）
External coupling （ Modules are related to environments other than software ）
Public coupling （ Multiple modules refer to the same global data area ）
Content coupling （ Access internal data , Code overlap or multiple entries ）
Cohesion refers to the closeness of the relationship among the elements within the module , The lower the cohesion, the poorer the independence of the module .
According to the degree of cohesion, there are 7 Species cohesive species .
coincidental cohesion （ Multiple tasks completed by the module , Loose relationship between tasks ）
Logical cohesion （ Module completes a set of logically related tasks ）
Instantaneous cohesion （ All tasks of the module must be performed at the same time interval ）
Procedural Cohesion （ The processing elements of the module are related and executed in a specific order ）
Communication Cohesion （ All elements of the module are concentrated on one data structure area ）
Sequential Cohesion （ Module processing element correlation , Must be executed in sequence ）
Functional Cohesion （ Module accomplishes a single function , Coordination of all parts , And indispensable ）