19. The number of parameters of the function (more useful)

xiaoxiao2021-03-06  83

-----------------

The number of functional parameters is best not too much. Generally, there are about 6 left and right, and many function parameters will make the people who read the code look very dizziness, and it is not conducive to maintenance. If there are many parameters, please use the structure to deliver parameters. This makes it easy to clean the data package and the simplicity of the program.

It is also beneficial to use the function, because if your function is a lot, such as 12, the caller is easy to make the order and number of parameters, while using the structural struct to transfer parameters, you can regardless of the parameters.

Moreover, the function is easily modified. If you need to add parameters to the function, you don't need to change the function interface, just change the internal processing of the structure and function, and this action is transparent to the program of the call function.

转载请注明原文地址:https://www.9cbs.com/read-107729.html

New Post(0)