4 ms·
Nice idea. Our new CTO brought in a tool he made for analyzing cyclomatic complexity and it’s been useful since we’re a heavily AI-forward shop. BTW, you can a
by appleappleapple 18d ago
Nice idea. Our new CTO brought in a tool he made for analyzing cyclomatic complexity and it’s been useful since we’re a heavily AI-forward shop.
BTW, you can avoid your comments being flagged and killed by writing them yourself! I know it’s tempting to offshore it to AI (especially after you’ve vibe-coded a whole project) but some genuine human communication goes a long way.
- crab_galaxy 18d agoI know cyclomatic complexity has been heavily debated for a long time, but I do think it’s valuable. It’s really good at highlighting common annoyances like overly clever code, nested ternaries, dense functions with too many branches… The only thing is that these issues seem like human code problems and IME LLMs don’t really write code like this anymore. It’s almost the opposite in python, actually, where Claude leans on writing lots of 2-3 liner private utils which is a separate kind of complexity and organization problem. I still find it useful specifically for React where it’s frustratingly normalized to write many branches in your JSX though.
- sagenschneider 18d agoThe difference to previous CC use, is the the change impact formula looks at the complexity already in the class/file. Typical CC just looks at the function it is change and not the context of the change. The Change Impact formula incorporates that to avoid god class and god method issues. Plus multiplying by number of files punishes for non-cohesive code bases. For me it puts the intuition of high cohesion and low coupling into a measurable metric.
- crab_galaxy 18d ago[dead]
- j_bum 18d agoIs it public? Would love to try it!
- ecshafer 18d agoSonarqube has existed for like 20 years. There's doezens of cyclomatic complexity, linter, and cve scanner tools though.
- sagenschneider 17d agoYep, not looking to replace cyclomatic complexity. Looking to use it in what I've researched is a novel new way. Instead of focusing solely on the complexity of the thing you change. Include the context around what you are changing also. This allows the Change Impact formula to differentiate between two different files of the same length. One is a complex god class with high CC. The other is an entity module that is simple but just has a lot of methods due to properties. Adding to the god class really should warrant a refactor. Adding to the entity class is just another field to store for the entity. The Change Impact formula can differentiate and point to the god classes.