Live data from Hacker News

Measuring Software Complexity: What Metrics to Use?

thevaluable.dev

1–10 of 87 posts

Re: Measuring Software Complexity: What Metrics to Use?

#2
This talks about code complexity a lot. This, however, is not the chief source of complexity in many code bases. The number of tools needed to build things is the bane of the modern software developer. Also, the use of microservices where none are needed results in and enormous increase in complexity. Code complexity is relatively easy to fix compared to all of this.

Re: Measuring Software Complexity: What Metrics to Use?

#6
There are a lot of things you can do to lower these sort of metrics without addressing actual complexity, sweeping the problem under the rug. Perhaps a better metric for software complexity would be the amount of work the computer has to do, or the number of instructions it has to execute.

Re: Measuring Software Complexity: What Metrics to Use?

#7
Ugh, no. I’ve worked in a codebase where CI would reject changes that had too much ‘code complexity’. You’d constantly have to find clever ways to split up your code, when doing so did not make sense, to appease the complexity checker. Oh yeah, and if you ever make a one-liner change, you might end up being forced to do a full refactor because that one line pushed the complexity threshold over the edge. The results: PITA for developers and worse code. What a crock of shit.

Re: Measuring Software Complexity: What Metrics to Use?

#8

There are a lot of things you can do to lower these sort of metrics without addressing actual complexity, sweeping the problem under the rug. Perhaps a better metric for software complexity would be the amount of work the computer has to do, or the number of instructions it has to execute.

Isn't this the true for all metrics? They are useful for pointing out problematic areas, but as soon as you start optimizing only based on the metric things will get worse.

Number of instructions is probably not a good metric. Without any loops/jumps you might have a lot of instructions, but a very low complexity.

An endless loop executes a lot of instructions, but does not have to be complex.

Re: Measuring Software Complexity: What Metrics to Use?

#9
post #2

This talks about code complexity a lot. This, however, is not the chief source of complexity in many code bases. The number of tools needed to build things is the bane of the modern software developer. Also, the use of microservices where none are needed results in and enormous increase in complexity. Code complexity is relatively easy to fix compared to all of this.

[deleted]

Re: Measuring Software Complexity: What Metrics to Use?

#10
Some blog linked from here (maybe jvns.ca?) made the case that depth of your project's software dependency tree is an important metric. The more crap you have to pull in, the more things can go wrong. You're better off with a large program with no dependencies, than a somewhat smaller program with a ton of dependencies.

Language features on the other hand can let you develop complex programs quickly and reliably, by catching errors before the code gets deployed and so on.

Post reply on HN