3 ms·
I can't help thinking that it should then be possible to write a tool that ingests a codebase and shows you a graph similar to the ones in this article. Perhap
by rossdavidh 9y ago
I can't help thinking that it should then be possible to write a tool that ingests a codebase and shows you a graph similar to the ones in this article. Perhaps that would be a good way to figure out where to start working on reducing the code complexity. But I have to think on this for a while to see if I still believe it after mulling it over.
- dochtman 9y agoSure that's possible. I saw Matt Mackall do it for Mercurial first: https://www.selenic.com/blog/?p=626 https://www.selenic.com/blog/?p=626 In rust, there's cargo-graph to do this for your packages: https://github.com/kbknapp/cargo-graph https://github.com/kbknapp/cargo-graph I used that on Servo once see PNG at https://dirkjan.ochtman.nl/files/servo-graph.png https://dirkjan.ochtman.nl/files/servo-graph.png or SVG at https://dirkjan.ochtman.nl/files/servo-graph.svg https://dirkjan.ochtman.nl/files/servo-graph.svg. From these explorations, I think the four color theorem-type planarity or connectedness is actually less important than a lack of cycles for the perceived complexity, or the difficulty encountered due to that complexity.
- disconnected 9y agoAges ago (back when Python 2.5 was still a thing) I used a lib that would generate a call graph for Python programs. I think it was this one: http://pycallgraph.slowchop.com/en/master/ I don't remember much, but I think this wasn't terribly useful at the time, because it became very messy very quickly. Any moderately complicated application will be calling a dozen functions, and the graph then becomes a gigantic mess of interconnected nodes which is very hard to read. But like I said, it was ages ago, so I don't know how good/bad it is now.
- JBiserkov 9y agoSee the work by Adam Tornhill https://github.com/adamtornhill/code-maat https://github.com/adamtornhill/code-maat https://www.youtube.com/watch?v=hWhBmJJZoNM https://www.youtube.com/watch?v=hWhBmJJZoNM https://pragprog.com/book/atcrime/your-code-as-a-crime-scene https://pragprog.com/book/atcrime/your-code-as-a-crime-scene https://pragprog.com/book/atevol/software-design-x-rays https://pragprog.com/book/atevol/software-design-x-rays
- carapace 9y agoFor Python there is Snakefood. I have had good results using it on a huge hairball project to discover interesting and useful things about the topology of the module dependencies. http://furius.ca/snakefood/ http://furius.ca/snakefood/ http://furius.ca/snakefood/doc/snakefood-doc.html http://furius.ca/snakefood/doc/snakefood-doc.html
- akud 9y agoyea, that's been one of my goals. I would like to visualize the graph over time to see how the complexity grows.