Recently, following an online tutorial, I tried to write nodejs and got a new understanding of node.
I found that if one file and one module are called, function transfer or object transfer must be involved in the call, and if the function reference passes several layers, this will increase the coupling degree of the program and cause inconvenience in maintenance. I want to know how everyone understands this problem.
Coupling between modules is inevitable, we can only reduce the degree of coupling between them.
When one module calls another module, it doesn’t care how it is implemented, only whether there is a corresponding interface to meet your needs.
When the function is implemented, do not modify or modify the input parameters to ensure that the same input parameters can obtain the same output results.
Using callback function and event mechanism can effectively reduce the coupling degree between modules