Modularity is a property that describes how replaceable the components or modules of a system are. A modular device has several parts that serve smaller functions which combine to serve the overall purpose of the device. Modules can be removed, replaced, or upgraded without affecting other components.
For example, most desktop computers are modular because they have easily removable and upgradeable parts. However, laptops are less modular because most of their components are not easy to access, remove, replace, or upgrade. Today, as e-waste becomes more of a problem, there are several companies that are trying to make more modular compact hardware solutions. For example, laptops from Framework are a good example of a modular laptop.
Computer software is modular if sections of code can be added or removed as needed. For example, the Linux kernel is modular. Its kernel modules can be loaded or unloaded by the system administrator, altering the capabilities of the OS without needing to reboot the computer.
Some computer programming languages refer to their libraries as "modules." Including a module in your program adds new capabilities by granting access to pre-written code objects. For example, in the Python programming language, the "random" module provides access to many powerful PRNG (pseudorandom number generator) functions.