News for hackers. Stuff that matters.
Re:Measuring Software Complexity: What Metrics to Use? by flaratt_ljos on Sunday November 28, 2021 @06:33AM (#29368070)
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? by nmehner on Sunday November 28, 2021 @06:45AM (#29368124)
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? by magicalhippo on Sunday November 28, 2021 @09:14AM (#29369037)
Complexity isn't a single thing though. The problem can be complex, a specific implementation can be complex, the codebase can be complex.

I recall implementing some linear algebra numerical code. The problem was a bit complex, resulting in a bit of code complexity.

However I realized I had some extra information I hadn't used, and I spent half a day going over the math again. After a couple of pages of derivations I could narrow down the result to a couple of dot products.

So, I ended up with a commit where I had 100 or so lines of comments including equations to justify my two lines of code.

The implementation became super-simple, but why it worked was suddenly not so simple. I had effectively moved complexity from code-space to problem-space.

Re:Measuring Software Complexity: What Metrics to Use? by drewcoo on Sunday November 28, 2021 @12:44PM (#29370982)
The problem is not computer processing speed. The problem is human cognitive load.
Re:Measuring Software Complexity: What Metrics to Use? by hutzlibu on Sunday November 28, 2021 @02:02PM (#29371771)
"Perhaps a better metric for software complexity would be the amount of work the computer has to do"

By that definition a loop doing 1 billion times a simple calculation would count as very complex, even though it is very easy to understand.

LOC would be better, even though code can be dense and complivated, or very verbose and simple.

Re:Measuring Software Complexity: What Metrics to Use? by preseinger on Sunday November 28, 2021 @05:32PM (#29373805)
> 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.

Complexity is a measure of human difficulty in comprehension, not mechanical difficulty in execution...