4 ms·
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 m
by flaratt_ljos 5y ago
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.
- nmehner 5y agoIsn'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.
- magicalhippo 5y agoComplexity 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.
- drewcoo 5y agoThe problem is not computer processing speed. The problem is human cognitive load.
- hutzlibu 5y ago"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.
- preseinger 5y ago> 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...