Excerpted from DomainDrivenDesignBook
Definition:
Problem: Everyone uses MODULES, but few treat them as a full-fledged part of the model. Code gets broken down into all sorts of categories, from aspects of the technical architecture to developers' work assignments. Even developers who refactor a lot tend to content themselves with
Modules conceived early in the project.
It is a truism that there should be low coupling between
Modules and high cohesion within them. Explanations of coupling and cohesion tend to make them sound like technical metrics, to be judged mechanically based on the distributions of associations and interactions. Yet it isn?t just code being divided into
Modules, but concepts. There is a limit to how many things a person can think about at once (hence low coupling). Incoherent fragments of ideas are as hard to understand as an undifferentiated soup of ideas (hence high cohesion).
Solution: Choose
Modules that tell the story of the system and contain a cohesive set of concepts. This often yields low coupling between
Modules, but if it doesn?t, look for a way to change the model to disentangle the concepts, or search for an overlooked concept that might be the basis of a
Module that would bring the elements together in a meaningful way. Seek low coupling in the sense of concepts that can be understood and reasoned about independently of each other. Refine the model until it partitions according to highlevel domain concepts and the corresponding code is decoupled as well.
See also: ModuleModules is mentioned on: Module | Packages | AbstractCore | MessagesByTopic | GenericSubdomains | UbiquitousLanguage | BigPicture