principles:more_is_more_complex
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
principles:more_is_more_complex [2021-02-01 23:28] – old revision restored (2020-12-10 03:48) 95.216.157.202 | principles:more_is_more_complex [2021-10-20 21:26] (current) – +++ restored +++ christian | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== Variants and Alternative Names ===== | ===== Variants and Alternative Names ===== | ||
+ | * Less is more | ||
===== Context ===== | ===== Context ===== | ||
/* fill in contexts here: */ | /* fill in contexts here: */ | ||
- | * [[contexts: | + | * [[contexts: |
+ | * [[contexts: | ||
+ | * [[contexts: | ||
+ | * [[contexts: | ||
+ | * [[contexts: | ||
+ | * [[contexts: | ||
===== Principle Statement ===== | ===== Principle Statement ===== | ||
Line 17: | Line 22: | ||
Having more lines of code, methods, classes, packages, executables, | Having more lines of code, methods, classes, packages, executables, | ||
+ | |||
+ | There is both: too large modules (i.e. undermodularization) and too small modules (i.e. overmodularization). Either there is too much complexity in a module (MIMC applied to one module) or there is too much complexity between the modules (MIMC applied to the number of modules). | ||
Note that it is actually not the number of lines, methods, classes, etc. that is relevant but the effective number of items that have to be kept in mind for the purpose of understanding. So reducing the number of lines by placing several statements in one line does not help. Neither the introduction of an additional obvious private method exceeding the limit will do any harm. MIMC is just a rule of thumb stating that the introduction of further modules (and the like) usually has a higher complexity as a drawback. | Note that it is actually not the number of lines, methods, classes, etc. that is relevant but the effective number of items that have to be kept in mind for the purpose of understanding. So reducing the number of lines by placing several statements in one line does not help. Neither the introduction of an additional obvious private method exceeding the limit will do any harm. MIMC is just a rule of thumb stating that the introduction of further modules (and the like) usually has a higher complexity as a drawback. | ||
+ | |||
+ | For documentation it simply states that fewer documentation is better. | ||
===== Rationale ===== | ===== Rationale ===== | ||
- | The capabilities of the human mind are certainly limited. If it is necessary to keep a large amount of modules or lines of code in mind, it is difficult to understand. Furthermore if a module is large, it takes a long time to read (and thus to comprehend). And if there are many modules, looking for a particular module takes a long time. And the longer the searching process takes, the more one will have forgotten what has been read previously. This results in worse readability, | + | The capabilities of the human mind are certainly limited. If it is necessary to keep a large amount of modules or lines of code in mind, it is difficult to understand. Furthermore if a module is large, it takes a long time to read (and thus to comprehend). And if there are many modules, looking for a particular module takes a long time. And the longer the searching process takes, the more one will have forgotten what has been read previously. This results in worse readability, |
- | Note that [[Miller' | + | Regarding documentation |
===== Strategies ===== | ===== Strategies ===== | ||
- | * Merge several modules into one | + | |
- | * Don't introduce a new module but put the functionality into another module | + | |
+ | * Don't introduce a new module but put the functionality into another module | ||
+ | * Avoid big modules | ||
+ | * Divide large modules into several smaller ones | ||
+ | * Introduce new modules to group related functionality. A [[patterns: | ||
===== Caveats ===== | ===== Caveats ===== | ||
- | See section | + | * Note that [[Miller' |
+ | * Note that this principle is contrary | ||
+ | * Furthermore note that having more classes can be regarded better than having too large classes. See [[Add More Classes]]. | ||
+ | * Having no documentation is best with respect to MIMC. But of course there are contrary principles. | ||
+ | See also section [[#contrary principles]]. | ||
- | ===== Origin ===== | ||
- | The phrase "more is more complex" | + | ===== Origin ===== |
+ | The phrase "more is more complex" | ||
===== Evidence ===== | ===== Evidence ===== | ||
/* Comment out what is not applicable and explain the rest: */ | /* Comment out what is not applicable and explain the rest: */ | ||
- | * [[wiki: | + | /* * [[wiki:Proposed]]*/ |
- | + | ||
- | /* * [[wiki:Examined]]*/ | + | |
/* * [[wiki: | /* * [[wiki: | ||
- | /* * [[wiki: | ||
+ | [[wiki: | ||
+ | |||
+ | This phenomenon that the defect density is high for small modules but also rises for large modules is called the " | ||
+ | |||
+ | This sounds intuitive but the Goldilocks Conjecture is disputed. Some point out that the negative correlation between defect density and size is just a mathematical artifact((Jarrett Rosenberg: //Some Misconceptions About Lines of Code// | ||
+ | |||
+ | The relationship between module size and defect proneness is complex and not clear. Furthermore modularization is not only a task in terms of module size. The more interesting aspect is how to assign responsibilities to modules. So apart from module size there are many other aspects influencing modularization (see especially [[Model Principle|MP]], | ||
+ | |||
+ | This is an important research question but as MIMC is just a qualitative rule of thumb (just as the other principles are). So the principle can be deemed helpful despite the Goldilocks Conjecture being disputed. | ||
+ | |||
+ | As a specific aspect of MIMC, complexity through deep inheritance relations is known to reduce effectiveness and efficiency of maintenance. There are controlled experiments showing this((John Daly, Andrew Brooks, James Miller, Marc Roper and Murray Wood: //An Empirical Study Evaluating Depth of Inheritance on the Maintainability of Object-Oriented Software// | ||
+ | |||
+ | [[wiki: | ||
===== Relations to Other Principles ===== | ===== Relations to Other Principles ===== | ||
Line 67: | Line 93: | ||
* **More Is More Complex (MIMC)**: Changing a design to adhere to the MIMC principle may always lead to more complexity concerning another aspect of the system. For example reducing the amount of code in a large method is typically achieved by the introduction of further methods. So there is always a tradeoff between this principle and itself. | * **More Is More Complex (MIMC)**: Changing a design to adhere to the MIMC principle may always lead to more complexity concerning another aspect of the system. For example reducing the amount of code in a large method is typically achieved by the introduction of further methods. So there is always a tradeoff between this principle and itself. | ||
* **[[High Cohesion]] (HC)**: Not introducing further modules typically leads to a lower cohesion. | * **[[High Cohesion]] (HC)**: Not introducing further modules typically leads to a lower cohesion. | ||
+ | * [[Add More Classes]]: While MIMC is a very general principle that applies to virtually everything, it may be regarded better to have more classes than bigger classes. | ||
+ | * [[More Stakeholders, | ||
+ | * [[Navigation Avoidance Principle]] (NAP): When trying to minimize documentation try not to create the need for navigation. | ||
==== Complementary Principles ==== | ==== Complementary Principles ==== | ||
* [[Miller' | * [[Miller' | ||
+ | * [[Document the Hard Stuff]] (DHS): When trying to minimize documentation DHS tells you what you should document and what you can leave out. | ||
+ | * [[Don' | ||
==== Principle Collections ==== | ==== Principle Collections ==== | ||
Line 77: | Line 108: | ||
- | ===== Example | + | ===== Examples |
FIXME | FIXME | ||
Line 90: | Line 121: | ||
===== Further Reading ===== | ===== Further Reading ===== | ||
+ | ===== Discussion ===== | ||
+ | Discuss this wiki article and the principle on the corresponding [[talk: |
principles/more_is_more_complex.1612218501.txt.gz · Last modified: 2021-02-01 23:28 by 95.216.157.202