Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Claude Code now reads AGENTS.md if there is no Claude.md(claude.com ↗)
    131comments
  2. Android 17 is the first since 3.x to add new APIs without releasing to the AOSP(grapheneos.social ↗)
    178comments
  3. Saving another 100TB of RAM(cloudflare.com ↗)
    33comments
  4. Cloudflare Quick Tunnels(cloudflare.com ↗)
    218comments
  5. Xcode 27.1 Beta Release Notes(developer.apple.com ↗)
    57comments
  6. Cache-to-Cache: Direct Semantic Communication Between LLMs (2025)(arxiv.org ↗)
    11comments
  7. Photon-Emission-Guided Laser Fault Injection Enables RP2350 Secure Debug(ledger.com ↗)
    43comments
  8. Show HN: Cactus Needle 3: 8-29MB automation models can match DeepSeek V4 Flash(cactuscompute.com ↗)
    71comments
  9. How to Write with an LLM(sockpuppet.org ↗)
    239comments
  10. US troop deaths during Iran war exceed Pentagon count by at least four(reuters.com ↗)
    9comments
  11. OpenJev(openjev.com ↗)
    235comments
  12. The first new cat species discovered in 100 years(nationalgeographic.com ↗)
    34comments
  13. Cyclomatic Complexity in C#(ndepend.com ↗)
    9comments
  14. Two parallel neural ectoderm progenitors contribute to the developing brain(newscientist.com ↗)
    50comments
  15. The Implications of Linguistic Illegibility for LLM Security(arxiv.org ↗)
    16comments
  16. From Geometry to Algebra and Back Again: 4000 Years of Papers (2023) [video](youtube.com ↗)
    discuss
  17. C++26: Trivial infinite loops are no longer undefined behaviour(sandordargo.com ↗)
    167comments
  18. Size-Specialized Memory Allocation(go.dev ↗)
    3comments
  19. Minimal Phone 2(minimalcompany.com ↗)
    143comments
  20. How SpaceX streamlined the Raptor engine(construction-physics.com ↗)
    23comments
  21. Warez: The Infrastructure and Aesthetics of Piracy (2021)(archive.org ↗)
    12comments
  22. I vibed a proof of Conway's conjecture(overreacted.io ↗)
    174comments
  23. Inside ZCode: Silently uploading your Git history to the cloud(ferstar.org ↗)
    89comments
  24. A search-and-inference database from scratch in pure Zig(antfly.io ↗)
    16comments
  25. Korea raises data breach fines to 10% of revenue(koreajoongangdaily.com ↗)
    70comments
  26. US Military had close call after using AI for hallucinated intelligence report(cnn.com ↗)
    275comments
  27. Cekura (YC F24) Is Hiring(ycombinator.com ↗)
    discuss
  28. Border agents can search cellphones without a warrant or reasonable suspicion(lawandcrime.com ↗)
    132comments
  29. Mathematicians Build Long-Awaited Graph Sandwich(quantamagazine.org ↗)
    15comments
  30. North Korean nuclear test sets off years of earthquakes(science.org ↗)
    147comments

Cyclomatic Complexity in C#

16 pointsby 2d agoblog.ndepend.com
9 comments
1h agoHN ↗

Anyone using tools like ndepend or others to help guide agents in refactors?

Personally I have a some tools that build dependency graphs (C# and Python) and store the results in a local database. Agents seem quite good at poking at this and coming up with refactor ideas. Graph analysis tools are useful here, simple application will detect cyclical dependencies, but I encourage the agents to use more complex tools like clustering to poke at the data.

32m agoHN ↗

I've been feeding agents dependency graphs plus CC and coverage data from a local store, and it works well for spotting cyclical deps and high-CC hotspots

1h agoHN ↗

Is there research that show if and how much a low complexity improves security?

36m agoHN ↗

Weird question to ask, that is pretty obvious.

Worst things happen always when 2 or more systems are combined because each system might be simple on its own, yet a combination is always much more complex.

29m agoHN ↗

It’s not obvious to me because cyclomatic complexity is not a straightforward proxy for the number of systems that are being combined.

It’s also the case that some of the most common sources of vulnerabilities, such as SQL injection, introduce no additional cyclomatic complexity. Heck, buffer overflows are good for your cyclomatic complexity - those array bounds checks are all extra branches.

18m agoHN ↗

Buffer overflow checks are really only going to be a linear growth in CC. It's when things move towards exponential growth or higher that it gets really easy to introduce flaws of many kinds.

Now, it's probably not a direct correlation. I'd think security bugs are more likely from programmers that unintentionally raise CC without really realizing it. Aka, overreaching their own knowledge when simpler structures are avaliable.

4m agoHN ↗

Sure. It’s just that there’s also so much research that has found that cyclomatic complexity is theoretically ill-founded, and that it tends to underperform other ways of measuring complexity. Most notably, just counting lines of code. (Not per function, in total.)

Here’s an oldie but goodie: https://cs.du.edu/~snarayan/sada/teaching/COMP3705/lecture/p...

35m agoHN ↗

Overall cyclomatic complexity is a useful metric, but it does have one shortcoming when used with modern languages: it was invented before polymorphism really became a thing.

That means that it really only counts explicit branching. So, for example, in an OO language like C#, calling a virtual method doesn’t increment cyclomatic complexity even though the method invocation could go down many code paths. Potentially thousands if you’re dealing with a common interface like IEnumerable. If you’re working on a library then the number of potential code paths in this kind of situation is unbounded.

As an aside, it’s interesting to think how it might apply to a language like Smalltalk that doesn’t even have if or switch statements.

OO isn’t the only monkey wrench, either. Higher-order functions also introduce forms of branching that cyclomatic complexity doesn’t measure.

Again that doesn’t make it a useless metric. Just don’t think that a cyclomatic complexity limit in your codebase is some sort of maintainability panacea. Some of the least comprehensible functions I’ve deciphered had quite low cyclomatic complexities.