Contents
Meta
—
* still in an early stage
—
* still in an early stage
Assign a responsibility to this module which has the largest subset of the required information.
Each module has a set of responsibilities. Subsystems have specific tasks, packages group several related classes, classes have methods and attributes, and so on. So there is a kind of mapping between modules and responsibilities. This mapping is good when the information which is necessary to fulfill the given task is present in the given module so there is no need to acquire all this information.
When this principle is not adhered to, then a module has a responsibility for which it is lacking some information. So in order to fulfill the task the module has to first acquire the needed information by invoking other modules. This increases the dependencies between the modules (which may lead toripple effects).
Sometimes assigning responsibilities using IE results in bas solutions (high coupling, low cohesion). This is because IE just focuses on the availability of data. So for example IE would demand domain objects saving themselves to the database. This is bad since it couples the domain objects to the database interface (JDBC, SQL, etc.) and lowers cohesion by adding unrelated responsibilities to the classes. Here it is better to give the task of persisting the domain objects to a separate class.4)
See also section contrary principles.
Craig Larman: Applying UML and Patterns – An Introduction to Object-Oriented Analysis and Design and Iterative Development
GRASP | ||||||
---|---|---|---|---|---|---|
Principles | Information Expert | High Cohesion | Low Coupling | |||
Non-Principles | Controller | Creator | Indirection | Polymorphism | Protected Variation | Pure Fabrication |