I'm interested in using call graphs/control flow i...
# thinking-together
m
I'm interested in using call graphs/control flow in a hierarchical way to understand programs better. The problem is there seems to be two extremes - high level diagrams done manually and low level call graphs generated by tools. A manual drawing with boxes and arrows is often used when describing a program at the highest level. While it works, one question is how to move to the next level of detail? Someone has to do that manually as well. These diagrams aren't connected to the source and can get out of date. The structure is going to change slowly at the highest level and so keeping up-to-date manually isn't that much trouble. More detailed levels, though, can change more frequently and keeping them up-to-date is more work. At the other extreme, tools to generate callgraphs give all the functions. They can filter by time, number of calls or call stack depth, but those doesn't necessarily correlate to what's important conceptually. I'm wondering if there's any work on anything between these two extremes? Both in generating it and visualizing it. (Searching online for 'hierarchical call graph' gives research on automated and machine learning approaches to discovering a hierarchy - interesting as research, but not what I'm after here. I would prefer something manual like adding program annotations or creating filtering terms - something that can be automated as part of a build or CI process.)
c
Re work in between the extremes of fully automated vs manual - check out Gail Murphy’s paper from 1995 about “reflexion” models, which were used to bridge this exact gap, and was tested by engineers who had to refactor Microsoft Excel. The core idea was to • define “patterns” for components • make an autogenerated graph of relations between those components • Have the system expert manually set a graph for their expectations for what 2 should look like • Diff 2 and 3 I talked about this paper and related work in this talk in 2019: https://github.com/hydrosquall/code-maps-frontend
❤️ 1
d
I would also look into the GRAIL (graphical programming language) system developed at RAND in the 1960s. A link to some of the technical documentation, but you can find video demos of it online. Plenty of good ideas there, few of which have been fully realized since then.
a
I’m interested in whatever you find about this - i’ve been building something to make direct manipulation of graphs with the hope that the immense “re-factorability” of Haskell & PureScript code would not be offset quite so much by tedious and error-prone line editing of code. (You can look at the demo linked in the README here and see some of possibilities. https://github.com/afcondon/purescript-d3-tagless-II) i’m using module and package graph data from the PureScript toolchain, but hope to get at least one level deeper to function calls and type definitions by using the AST someday.