Modular programming enables one to organize code into independent, cohesive modules, which can be combined together to achieve the desired functionality. This allows in creating code that is:
- More cohesive because the modules are built with a specific purpose, so the code that resides there tends to cater to that specific purpose.
- Encapsulated because modules can interact with only those APIs that have been made available by the other modules.
- Reliable because the discoverability is based on the modules and not on the individual types. This means that if a module is not present, then the dependent module cannot be executed until it is discoverable by the dependent module. This helps in preventing runtime errors.
- Loosely coupled. ...