Software Complexity

Definition

Software complexity is how complicated and tangled a computer program or system is. When software is complex, it can be challenging to work with and understand, making it more likely to have problems or errors.

What makes software complex?

  • too many moving parts
  • invisible changes
  • uncontrolled mutability
  • lack of cohesion
  • excessive dependencies
  • technology infatuation
  • low level concurrency
  • imperative style
  • entwinement

Identify Complexity

One of the most important skills in Software Engineering is being able to identify essential complexity and eliminate unnecessary complexity. Minimize creating complexity at all where possible.

Twitter (Addy Osmani)

Consequences

Wirth's Law

Software is getting slower more rapidly than computer hardware is becoming faster.

Slow, inefficient software

Goal: Simplicity

Edsger Wybe Dijkstra - Simplicity

Simplicity is a great virtue but it requires hard work to achieve it and education to appreciate it. And to make matters worse: complexity sells better

β€” Edsger W. Dij – On the nature of Computing Science (1984)

See also Boring Technology.

Causes & solutions

Overengineering

Prevent over-engineering

Technical Debt

#TO/EXPLORE

Software Architecture Complexity

See also Sustainable Software Architecture.

Metrics for code complexity

Cyclomatic Complexity

Cyclomatic complexity is a software metric used to indicate the complexity of a program. It is a quantitative measure of the number of linearly independent paths through a program's source code. It was developed by Thomas J. McCabe, Sr. in 1976.

Cyclomatic complexity is computed using the control-flow graph of the program: the nodes of the graph correspond to indivisible groups of commands of a program, and a directed edge connects two nodes if the second command might be executed immediately after the first command. Cyclomatic complexity may also be applied to individual functions, modules, methods or classes within a program.

― Wikipedia (2023-02-12)

A more simpler way to calculate the cyclomatic complexity is to count every if, while, for and case statements in your code as well as the entry to your function or method.

A good cyclomatic complexity is a value between 1 and 4.

NPATH – acyclic execution path

acyclic execution path = Unique path through the code

Code Complexity vs. Experience

Software Complexity-1676203710537.jpeg|500
by Flavio Copes (β†’Twitter)

Examples:

Studies

The Root Cause of Failure in Complex IT Projects: Complexity Itself

venters.etal.2018.softwaresustainabilityresearch (pg. 25)

As a result of changing stakeholder requirements, software systems are the product of accidental complexity that presents significant challenges with regards to maintenance and evolution. While Brooks [1986] argues that complexity is an essential property of software it should not be accidental; this presents significant challenges and threats to ensure the dependability and longevity of software systems.

πŸ”— References

Complexity is the enemy by Evan Martin

Don't Walk Away from Complexity, Run (GOTO 2018) (Venkat Subramaniam)

What is software complexity and how can you manage it? | The Man in the Arena

The Evolution of a Software Engineer | by Sean Hickey | Medium

Software and its Discontents, Part 2: An Explosion of Complexity by Kellan Elliott-McCrea

Root causes of more complexity:

  1. The complexity of rising standards
  2. The complexity of too many choices
  3. Complexity and technical decision making in the era of abundance
  4. The complexity of large teams and aging code bases
  5. Aspirational complexity