3 ms·
I’ve become increasingly skeptical of both cognitive and cyclomatic complexity metrics in recent years. I think for 2 reasons. Firstly, they don’t account for
by michalc 5y ago
I’ve become increasingly skeptical of both cognitive and cyclomatic complexity metrics in recent years.
I think for 2 reasons.
Firstly, they don’t account for complexity you need to solve your problem. And secondly, they seem to suggest that splitting up the same functionality over more functions, so each has a lower complexity, is “better” - this isn’t always the case, at least for me. Often I find following the flow/logic of loads of small functions more difficult than through lines in the same function.
The examples I’ve seen in articles such as this are always fairly clear cut “well yes of course these small re-written functions are clearer”, but they don’t really seem to consider the wider context of complex requirements?
I don’t really have an alternative metric to suggest though… I wish I did!