User Tools

Site Tools


principles:more_is_more_complex

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
principles:more_is_more_complex [2021-09-02 10:44] – old revision restored (2021-05-19 09:40) 65.21.179.175principles:more_is_more_complex [2021-09-02 14:03] – old revision restored (2021-05-19 09:40) 65.21.179.175
Line 3: Line 3:
 ===== Variants and Alternative Names ===== ===== Variants and Alternative Names =====
  
-  * Miller's Law (this is the law about the conceptual limit independent of software development) 
  
 ===== Context ===== ===== Context =====
Line 17: Line 16:
 ===== Description ===== ===== Description =====
  
-Having more lines of code, methods, classes, packages, executables, libraries etc. always means also to have more complexity (which is bad). An ideal number can be around sevenwhich means: +Having more lines of code, methods, classes, packages, executables, libraries etc. always means also to have more complexity (which is bad). This means that given the complexity of the problem is fixed, a suitable compromise for the number of methodsclasses, etc. has to be found. Reducing the number of statements per method typically results in the introduction of further methods. Reducing the number of methods per class can be achieved by dividing the class into several smaller classesetc.
-  * seven lines of code per method +
-  * seven methods per class +
-  * seven classes in a sub-system +
-  * etc.+
  
-Of course this is not possible in a realistically-sized software system. So more realistic values can be debated. Seven parameters to a method is quite much and can be regarded way too many. On the other hand seven methods per class and seven classes per subsystems are usually too few. Also seven lines of code per method is sometimes not realistically achievable. +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.
- +
-This means that given the complexity of the problem is fixed, a suitable compromise for the number of methods, classes, etc. has to be found. Reducing the number of statements per method typically results in the introduction of further methods. Reducing the number of methods per class can be achieved by dividing the class into several smaller classes, etc. +
- +
-Furthermore 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. 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.+
  
  
 ===== Rationale ===== ===== Rationale =====
  
-The human brain can only handle relatively small amount of "items" or "chunks" of information efficiently in the short-time memoryThis cognitive limit is commonly referred to as being "seven plus or minus two" items ((George AMiller: //[[http://www.psych.utoronto.ca/users/peterson/psy430s2001/Miller%20GA%20Magical%20Seven%20Psych%20Review%201955.pdf|The Magical Number SevenPlus or Minus Two: Some Limits on Our Capacity for Processing Information]]//))+The capabilities of the human mind are certainly limited. If it is necessary to keep large amount of modules or lines of code in mind, it is difficult to understandFurthermore 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 timeAnd the longer the searching process takes, the more one will have forgotten what has been read previouslyThis results in worse readabilityunderstandability and this maintainability.
  
-While the human short-term memory is far more complex than can be expressed in a catchphrase like "7±2", it is certainly true that it is somehow limited. For the validity of the MIMC principle the actual number of items is as irrelevant as the precise inner-workings of the human mind. Short-term memory is undoubtedly limited and exceeding this limit will impose a much higher effort for understanding. This has a negative effect on maintainability and defect introduction.+Note that [[Miller's Law]] is often cited in this context but it is doubtful if and to what extend it applies.
  
  
 ===== Strategies ===== ===== Strategies =====
  
-  * Divide a large module into several smaller ones. +  * Merge several modules into one 
-  * Don't introduce a new module if it will be only a very small one.+  * Don't introduce a new module but put the functionality into another module
  
  
 ===== Origin ===== ===== Origin =====
  
-  * For the short-term memory capacity limit being around "seven plus or minus two" also known as "Miller's Law" the original source is: George A. Miller: //[[http://www.psych.utoronto.ca/users/peterson/psy430s2001/Miller%20GA%20Magical%20Seven%20Psych%20Review%201955.pdf|The Magical Number Seven, Plus or Minus Two: Some Limits on Our Capacity for Processing Information]]// +The phrase "more is more complex" is new but can be regarded trivially intuitive to every developer.
-  * The phrase "more is more complex" is new but can be regarded trivially intuitive to every developer.+
  
  
 ===== Evidence ===== ===== Evidence =====
 /* Comment out what is not applicable and explain the rest: */ /* Comment out what is not applicable and explain the rest: */
-  * [[wiki:Proposed]]: FIXME+  * [[wiki:Proposed]]
  
 /*  * [[wiki:Examined]]*/ /*  * [[wiki:Examined]]*/
Line 62: Line 52:
 ==== Generalizations ==== ==== Generalizations ====
  
-  * [[principles:Keep It Simple Stupid]] (KISS): MIMC states that having more modules, etc. leads to more complexity. KISS on the other hand is about the avoidance of every form of complexity.+  * [[Keep It Simple Stupid]] (KISS): MIMC states that having more modules, etc. leads to more complexity. KISS on the other hand is about the avoidance of every form of complexity.
  
 ==== Specializations ==== ==== Specializations ====
Line 71: Line 61:
  
   * **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.
-  * **[[principles: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.
  
 ==== Complementary Principles ==== ==== Complementary Principles ====
 +
 +  * [[Miller's Law]]: This is the law about a conceptual limit often cited as a (user interface) design rule.
  
 ==== Principle Collections ==== ==== Principle Collections ====
  
 {{page>collections:OOD Principle Language#Box}} {{page>collections:OOD Principle Language#Box}}
 +
  
 ===== Example ===== ===== Example =====
  
 FIXME FIXME
 +
  
 ===== Description Status ===== ===== Description Status =====
principles/more_is_more_complex.txt · Last modified: 2021-10-20 21:26 by christian