principles:high_cohesion
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
principles:high_cohesion [2020-12-08 23:18] – old revision restored (2020-10-12 16:15) 116.202.49.99 | principles:high_cohesion [2021-09-02 12:37] – old revision restored (2021-03-25 15:16) 65.21.179.175 | ||
---|---|---|---|
Line 25: | Line 25: | ||
===== Strategies ===== | ===== Strategies ===== | ||
- | |||
- | * Divide one large module into several smaller but more cohesive ones | ||
- | ===== Caveats ===== | ||
- | |||
- | See section [[#contrary principles]]. | ||
===== Origin ===== | ===== Origin ===== | ||
+ | /* the *primary* source */ | ||
Line 51: | Line 47: | ||
==== Specializations ==== | ==== Specializations ==== | ||
+ | * [[Tell don't Ask/ | ||
* [[Constantine' | * [[Constantine' | ||
* [[Single Responsibility Principle]] (SRP): SRP is a stronger version of HC. | * [[Single Responsibility Principle]] (SRP): SRP is a stronger version of HC. | ||
Line 59: | Line 56: | ||
* [[More Is More Complex]] (MIMC): Making a module highly cohesive often results in additional modules. Sometimes it is simpler to assign a minor unrelated responsibility to a module, which lowers the cohesion. | * [[More Is More Complex]] (MIMC): Making a module highly cohesive often results in additional modules. Sometimes it is simpler to assign a minor unrelated responsibility to a module, which lowers the cohesion. | ||
* [[Model Principle]] (MP): Adhering to HC sometimes means to split up a class into several smaller ones which might correspond to the model less well. | * [[Model Principle]] (MP): Adhering to HC sometimes means to split up a class into several smaller ones which might correspond to the model less well. | ||
- | * [[Low Coupling]] (LC): A system consisting of one single module has a very low coupling as there are no dependencies on other modules. But such a system also has low cohesion. The other extreme, very many highly cohesive modules, naturally has a higher coupling between the modules. So here a compromise has to be found. | ||
- | |||
==== Complementary Principles ==== | ==== Complementary Principles ==== | ||
- | * [[Tell don't Ask/ | + | * [[Low Coupling]] (LC): A system consisting of one single module has a very low coupling as there are no dependencies on other modules. But such a system also has low cohesion. |
* [[Encapsulate the Concept that Varies]] (ECV): Adhering to HC often results in modules to be split up into several more cohesive ones. ECV gives further advice on how to do that. | * [[Encapsulate the Concept that Varies]] (ECV): Adhering to HC often results in modules to be split up into several more cohesive ones. ECV gives further advice on how to do that. | ||
Line 73: | Line 68: | ||
- | ===== Examples | + | ===== Example |
Line 87: | Line 82: | ||
* [[wp> | * [[wp> | ||
* [[wiki> | * [[wiki> | ||
- | * Craig Larman: //Applying UML and Patterns – An Introduction to Object-Oriented Analysis and Design and Iterative Development// | ||
principles/high_cohesion.txt · Last modified: 2021-10-18 21:36 by christian