当前位置:网站首页>What is modularity? Benefits of modularity
What is modularity? Benefits of modularity
2022-06-12 12:04:00 【Mustang (Mustang)】
What is modularity
In short , Modularization is to divide a large file into independent and interdependent small modules in an organized way .
There are many private properties inside the module , Only a part of the exposed interface is exposed ( For example, you can modify the methods of private attributes )
Modularity is a way to deal with the decomposition of complex systems into better manageable modules .
The so-called modular development is packaging details , Provide and use interfaces , Don't affect each other , Each module implements a specific function . The foundation of modular development is function . Modular development reduces code coupling , The significance of modularity is to maximize design reuse , With the least number of modules 、 Spare parts , More quickly meet more personalized needs .
The benefits of modularity
ES6 Before ,JavaScript The language has never had a module (module) system , Large files cannot be organized into small pieces , And manage dependencies between . But the idea of modularity has always existed . Because with Javascript The code is getting bigger and bigger , And web pages are more and more like desktops APP. Such a jumble of code , If not modularized , May cause naming conflicts , Not easy to reuse 、 High maintenance .
The benefits of using modular development
1. High cohesion and low coupling , It is conducive to team operation , When the project is complex , Divide the project into sub modules and assign them to different people for development , Finally, put it together , This can reduce the dependency between modules and reflect low coupling , The module has specific functions to reflect high cohesion .
2. reusable , Convenient maintenance , The characteristic of the module is that it has specific functions , When both projects need some functionality , We define a specific module to implement this function , In this way, you only need to introduce this module in both projects to realize this function , No need to write repetitive code ; And when the requirements change and the function needs to be changed , We modify this module directly , In this way, you can modify the functions of all projects , It's easy to maintain .
3、 adopt exports Expose interfaces . This means that no namespace is needed , Not to mention global variables . This is a complete naming conflict solution .
4、 adopt require Introduce dependencies .** This allows dependencies to be built in , Developers only need to care about the dependency of current modules , Other things Sea.js/ Require.js They'll handle it automatically
边栏推荐
- 淘宝新改版商家如何操作,需要注意的点有哪些
- One must keep writing, so as not to be submerged by the vast crowd.
- How to select standard products and non-standard products, the importance of selection, and how to layout the store
- 机器学习之决策树
- ioremap
- 视频分类的类间和类内关系——正则化
- ARM指令集之杂类指令
- Reprint --win10 open the task manager to solve the blue screen problem
- ARM指令集之批量Load/Store指令
- 【QNX Hypervisor 2.2 用户手册】4.1 构建QNX Hypervisor系统的方法
猜你喜欢

Beyondcompare 4 uses PJ

Who moved my package lock

必杀技--使用FFmpeg命令快速精准剪切视频

TinyMCE series (I) TinyMCE environment construction

LeetCode 890. 查找和替换模式(模拟+双哈希表)

Common debugging tools and commands for ROS

QT based travel query and simulation system

conda环境下pip install 无法安装到指定conda环境中(conda环境的默认pip安装位置)

Ficusjs series (I) introduction to ficusjs

6.6 rl:mdp and reward function
随机推荐
服务端渲染与客户端渲染的区别(优缺点)
Load/store instruction addressing mode of arm instruction set (2)
LeetCode 497. 非重叠矩形中的随机点(前缀和+二分)
TinyMCE series (III) introduction to common TinyMCE APIs
单页面开发与多页面开发的优缺点
[QNX hypervisor 2.2 user manual] 4.1 method of building QNX hypervisor system
Pytoch notes
LeetCode 890. Find and replace mode (analog + double hash table)
【QNX Hypervisor 2.2 用户手册】4 构建QNX Hypervisor系统
[foundation of deep learning] back propagation method (1)
Promise controls the number of concurrent requests
The second day of QML study
無重複字符的最長字符串(LeetCode 3)
QT添加QObject类(想使用信号和槽)遇到的问题汇总,亲测解决有效error: undefined reference to `vtable for xxxxxx(你的类名)‘
MVC模式、加密、jsonwebtoken
LeetCode_二分搜索_中等_162. 寻找峰值
Design of tablewithpage
ARM指令集之Load/Store访存指令(二)
One must keep writing, so as not to be submerged by the vast crowd.
【数据库】sqlite版本升级、降级