In software design, the design process is generally divided into the following three steps:
The first step is to divide functional modules according to the software requirements. At this time, modules are divided according to functional requirements.
Step 2: submodules of the real-time function module are divided according to the professional fields. Specialized fields, such as data structure algorithms, graphic interfaces, I/O operations, network communication, and hardware operations.
Step 3: Based on some basic principles, submodules are subdivided into small modules that are similar to building blocks. These small modules are part of the coding implementation.
In terms of software structure design, a hierarchical structure should be adopted to improve software quality and facilitate future migration, upgrading, and maintenance. The software should be divided into at least the application layer, middle layer, and driver layer.
When dividing small modules, there are several standard principles that must be followed:
I. Maximize module independence
To maximize the independence of a module is an important principle of dividing the module, that is, the module should be "highly cohesive, low coupling ".
Ii. Proper module size division
There is no absolute standard for dividing the module size into the most reasonable ones. For the function module, it is appropriate to control the number of lines in the program within the range of less than 100 rows.
Iii. Centralized Management of hardware-related components
Hardware configuration-related programs belong to the driver layer in the software structure. The benefits of centralized management are convenience for future transplantation and program modification caused by hardware changes.
4. Establish a shared module to improve the reusability of the program
5. Maintain a reasonable module fan-out rate and fan-In Rate
The fan-out rate of a module refers to the number of other modules directly controlled by this module. The fan-in rate of a module refers to the number of modules directly controlled by this module.