What is modularity?
Before we move to Java Platform Module System, let's understand the meaning of modularity in the real world.
Modularity is a design that divides systems into smaller parts called a module. Nowadays, modular kitchens are installed in homes. These types of kitchen include several units or modules such as wall cabinets, cupboards, sinks, and many more and all these different parts are built in factories. If at any time there is damage in any unit, then only that module needs to be replaced or repaired.
Another familiar modular system is electric outlets in walls, which allow you to plug in different types of electrical gadgets such as microwaves, mixer grinders, refrigerators, televisions, and they are all designed to work on defined tasks. These devices work in any outlet without caring whether it is in our home or a neighbor's home, they just do their task and function when they are plugged in.
In terms of computer systems, modularity is a concept of combination and linking of multiple independent modules in a single system. It increases usability and removes duplication of code and also makes a system loosely coupled. Similar to the electric outlet concept, modules should do their task without caring where they are plugged into an application.