User Tools

Site Tools


principles:tell_don_t_ask_information_expert

Tell Don't Ask/Information Expert (TdA/IE)

Variants and Alternative Names

  • Expert
  • Do It Myself

Context

Principle Statement

Assign a responsibility to this module which has the largest subset of the required information.

Description

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.

Rationale

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).

Strategies

Origin

Craig Larman: Applying UML and Patterns – An Introduction to Object-Oriented Analysis and Design and Iterative Development

Evidence

Relations to Other Principles

Generalizations

  • Low Coupling Adhering to the information expert principle leads to low coupling as there is less need to communicate with other modules to get the necessary information.
  • High Cohesion Adhering to information expert also means that a module only has responsibilities which belong together. So this increases cohesion.

Specializations

Contrary Principles

  • More Is More Complex (MIMC): Adhering to TdA/IE sometimes results in adding further methods.
  • Principle of Separate Understandability (PSU): Assigning responsibilities using TdA/IE bears the danger of violating PSU as responsibilities are assigned based on data availability instead of separate understandability.

Complementary Principles

  • Model Principle (MP): TdA/IE tells how to distribute functionality among the natural classes which are created according to the Model Principle.
  • Information Hiding/Encapsulation (IH/E): Assigning responsibilities to objects using Information Expert may accidentally break encapsulation. It typically does not but it has to be considered.

Principle Collections

OOD Principle Language
General Principles
ML KISS MIMC DRY GP RoE
Modularization Principles
MP HC ECV
Module Communication Principles
TdA/IE LC DIP
Interface Design Principles
EUHM PLS UP
Internal Module Design Principles
IH/E IAP LSP PSU
GRASP
Principles Information Expert High Cohesion Low Coupling
Non-Principles Controller Creator Indirection Polymorphism Protected Variation Pure Fabrication

Example

Description Status

Further Reading

principles/tell_don_t_ask_information_expert.txt · Last modified: 2021-03-28 06:13 by 188.34.200.103