‹ BackHN Continuity

Thread

Cyclomatic Complexity in C#

87 points · 29 comments · gone35

  1. runningmike · · focus · HN ↗
    From a security perspective cc is highly relevant. I use it to get a solid rating of the security aspects of Python code. I use [1] which is solid and proven.

    [1] <a href="https:&#x2F;&#x2F;nocomplexity.com&#x2F;documents&#x2F;codeaudit&#x2F;complexitycheck.html#complexity-check" rel="nofollow">https:&#x2F;&#x2F;nocomplexity.com&#x2F;documents&#x2F;codeaudit&#x2F;complexitycheck...

    1. thomasmg · · focus · HN ↗
      Is there research that show if and how much a low complexity improves security?
      1. runningmike · · focus · HN ↗
        Nice question! Plenty (open) research papers and thesis available the last 40 years -)

        Some nice papers: <a href="https:&#x2F;&#x2F;arxiv.org&#x2F;pdf&#x2F;2002.07135" rel="nofollow">https:&#x2F;&#x2F;arxiv.org&#x2F;pdf&#x2F;2002.07135 , <a href="https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2411.17343" rel="nofollow">https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2411.17343, <a href="https:&#x2F;&#x2F;doi.org&#x2F;10.25300&#x2F;MISQ&#x2F;2025&#x2F;49.1.075" rel="nofollow">https:&#x2F;&#x2F;doi.org&#x2F;10.25300&#x2F;MISQ&#x2F;2025&#x2F;49.1.075 or see <a href="https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2411.17343" rel="nofollow">https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2411.17343

        There are many studies about this subject, but mind that complexity in code something different than &#x27;complex&#x27; systems. You will need to dive into complexity science , but hard and &#x27;soft&#x27; aspects should be taken into account when it comes to cyber security!

        1. thomasmg · · focus · HN ↗
          Well the first is a discussion without an analysis of existing code, the second is about smart contracts. I&#x27;m not convinced that _cyclomatic_ complexity of a function plays a role in security at all. Why:

          (a) We have plenty of evidence that buffer overflows etc play a role (caused by using manual memory management), but not so for cyclomatic complexity.

          (b) Trying to reduce cyclomatic complexity in one function typically increases the complexity somewhere else, and so is not helping. Often this is just moving stuff around, and sometimes makes things more complex.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.