McCabe's Cyclomatic Complexity and Why We Don't Use It (2014)
cqse.eu
cqse.eu
[1]: http://www.scirp.org/journal/PaperInformation.aspx?PaperID=7... "Cyclomatic Complexity and Lines of Code: Empirical Evidence of a Stable Linear Relationship"
Part 1: https://www.artima.com/weblogs/viewpost.jsp?thread=210434
Part 2: https://www.artima.com/weblogs/viewpost.jsp?thread=210575
crap4j: https://www.artima.com/weblogs/viewpost.jsp?thread=215899
PHP: http://jacobsantos.com/blog/2007/general/what-is-your-crap-i...
PHP: http://www.levihackwith.com/how-to-read-and-improve-the-c-r-...
Preferably, several of them that are more likely to disagree. ;)
I think the main problem is that complexity is a bug light for hackers; we know it will probably end badly, but the appeal is so intoxicating that we just can't help ourselves.
[1] https://en.wikipedia.org/wiki/Cyclomatic_complexity
[2] http://lists.dragonflybsd.org/pipermail/users/2016-January/2...
That's a good metaphor. There's two ways of looking at this situation: human-centric and tool-centric. The human side is that anything too complex to understand can hide flaws in local implementation or interactions with other things. The tooling side is that things too complex for our tools to analyze can't give us the assurance level of alternatives. I think McCabe's works value is on tooling part but too often is assessed on human side. The counter-example is a good one where something is easy to verify for humans but produces a meaningless number that represents what tools would perceive.
My rule of thumb is: Can you understand everything the software might do in success or error states? Have you tested that to be sure it does? Have you expressed it simply enough to apply static or dynamic analysis tools to show its safety against common cases of error?
These things seem to be a pre-requisite for software that's correct by construction. Just one part of the process among many. Yet, a critical one. Work like McCabe's may help on tooling side. Yet, we often have a better shortcut: your code doesn't pass if the analysis can't prove its safe after X amount of runtime. "Animats" said that's Microsoft's approach to certification of drivers with their amazing SLAM verification kit: run it w/ an hour max. Driver quality is higher than ever despite complexity being higher than ever. Direct result of their assurance activities.