User Tools

Site Tools


principles:more_is_more_complex

More Is More Complex (MIMC)

Variants and Alternative Names

  • Miller's Law (this is the law about the conceptual limit independent of software development)

Context

Principle Statement

More is more complex.

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 seven, which means:

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

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

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

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.

Strategies

  • Divide a large module into several smaller ones.
  • Don't introduce a new module if it will be only a very small one.

Origin

Evidence

Relations to Other Principles

Generalizations

  • 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

Contrary Principles

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.

Complementary Principles

Principle Collections

OOD Principle Language
General Principles Modularization Principles
KISS DRY GP MP IE LC HC

Example

FIXME

Description Status

Further Reading

principles/more_is_more_complex.txt · Last modified: 2020-11-29 01:55 by 159.69.189.215