1. What is modularity?

Modularity is a way of dealing with the decomposition of complex systems into better manageable modules.Copy the code

Modular development encapsulates details, provides interfaces that do not affect each other, and each module implements a specific function. The foundation of modular development is functions. Modularization development reduces the coupling degree of code, the meaning of modularization is to maximize the design reuse, with the least modules, parts, more quickly meet more personalized needs.

Why do modules decouple and reuse? Reason: In order to decouple the service modules after the modular separation of services, each module is independent and there is no dependency between them. Each module is responsible for different functions, different business logic, business decoupling between modules. Module function is relatively single, can be used in multiple projects.

Why can a module be compiled separately to improve development efficiency? Reason: Each module is actually a complete project that can be compiled and debugged separately

Why can multiple teams develop and test in parallel? Reason: Each team is responsible for different modules to improve development and test efficiency

2. Benefits of modularity

Through exports exposed interfaces. This means there is no need for namespaces, let alone global variables. This is a radical naming conflict resolution solution. ** Introduce dependencies via require. ** This allows dependencies to be built in, so developers only need to care about the dependencies of the current module, and everything else will be taken care of automatically by sea-.js/require.js