This is an old revision of the document!
Table of Contents
More Is More Complex (MIMC)
Variants and Alternative Names
- Miller's Law (this is the law about the conceptual limit independent of software development)
More is more complex.
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 seven, which means:
- seven lines of code per method
- seven methods per class
- seven classes in a sub-system
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.
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.
The human brain can only handle a relatively small amount of “items” or “chunks” of information efficiently in the short-time memory. This cognitive limit is commonly referred to as being “seven plus or minus two” items 1). So exceeding this limit will impose a much higher effort for understanding. This has a negative effect on maintainability and defect introduction.
- Divide a large module into several smaller ones.
- Don't introduce a new module if it will be only a very small one.
- 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: 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.
Relations to Other 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.
Note that many principles are contrary to MIMC as they favor the introduction of additional modules. This means that it is worthwhile to consider MIMC when considering one of those. Nevertheless this does not mean that this is true the other way around. When considering MIMC, one wouldn't want to consider all principles that have complexity as a disadvantage. So here are those needing consideration:
- 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.