Modularity

Modularity in software development is the amount of components in a system that can be divided into smaller sub-systems and then re-combined in a variety of configurations.

Modularity
Web browser with boxed paired b color to signify modules

Modularity in software development is the amount of components in a system that can be divided into smaller sub-systems and then re-combined in a variety of configurations. These components have varied levels of dependence and independence, hiding the complexity behind a standardized interface or API. By using the interface, the components are able to interact, connect or exchange resources with each other. A modular system is attributed as a “loosely coupled” since each component does not contain any other particular component as a dependency to be able to function. As these components evolve or are replaced, it does not affect the overall system. A properly documented component with a clean API makes it easy to redesign without having a deep understanding of the overall system. It is imperative that when designing a component to emphasize simplicity over complexity, making each component small and easy to read.

The benefits of building such a system are:

  • Reusability: You can re-use components in the same system or other systems multiple times
  • Flexibility: Saves resources by not having to re-create a component to assemble a new system and improves collaboration in a team since they can focus on individual parts without affecting the others
  • Testability: Components with isolated dependencies and a clear API makes them highly testable, ensuring quality of the overall system

Tim Berners-Lee described the principle in Axioms of Web Architecture in favor of building a modular system:

"When you design a system, or a language, then if the features can be broken into relatively loosely bound groups of relatively closely bound features, then that division is a good thing to be made a part of the design. This is just good engineering. It means that when you want to change the system, you can with luck in the future change only one part, which will only require you to understand (and test) that part. This will allow other people to independently change other parts at the same time. "

As you design a new system, keeps this principle in mind and build a library of components that can make each iteration easier.


References