The need for modules
Let’s start by clarifying the difference between a module and a module system. A module is the actual piece of software, while a module system is the syntax and tools that let us define and use modules in our projects.
No matter the programming language or the platform, a good module system should help with some fundamental needs of software engineering:
- Organizing code: It should allow the code base to be split into multiple files. This keeps the code more organized and easier to understand, and enables independent development and testing of different parts.
- Code reuse and dependency management: A good module system should make it easy to share and reuse functionality across projects while handling dependencies in a straightforward way. Developers should be able to build on existing modules, including third-party ones, and users should be able to import a module together with everything it requires without friction.
- Encapsulation...