Key Takeaways
Modularity strives to minimize complexity by managing the distribution of knowledge across modules. However, the overarching goal of modularity is to enable evolution of the system according to future goals and needs. Hence, modular design requires awareness not only of the current requirements, but also of those that might arise in the future.
Nevertheless, be aware of the “too much of a good thing” syndrome. A system that is flexible to accommodate any change is likely to be overly complicated. Striking a balance is crucial to prevent systems from becoming exceedingly rigid or overly flexible.
To train your “muscle” of predicting future changes, learn about the business domain of your system. Analyze the trends: what changes were required in the past, and why. Learn about competing products: what they are doing differently, why they are doing these things differently, and how likely the functionality is to change in your system.
When designing modules, reason about their core properties. Can you state a module’s function (purpose) without revealing its implementation details (logic)? Is a module’s usage scenario (context) explicitly stated, or is it based on assumptions that might be forgotten over time?
Ultimately, to truly design modular systems, one must consider modules in relation to each other, acknowledging that their interplay significantly impacts modularity. Coupling defines what knowledge is shared between components, and cohesion indicates how related a module’s responsibilities are. These topics will be expanded upon in the forthcoming chapters, eventually forming a robust framework to inform modular design.