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.
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.
Consequences
Goal: Simplicity
See also Boring Technology.
Causes & solutions
Overengineering
Technical Debt
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
by Flavio Copes (βTwitter)
Examples:
Studies
The Root Cause of Failure in Complex IT Projects: Complexity Itself
π 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:
- The complexity of rising standards
- The complexity of too many choices
- Complexity and technical decision making in the era of abundance
- The complexity of large teams and aging code bases
- Aspirational complexity