Tools for visualizing a codebase
lmy.medium.com
lmy.medium.com
I explored the topic of visual programming a couple of years ago and presented the first attempt to make the code visualization tool useful and practical in this long-read - "Rethinking visual programming with Go" [1]
The key point is that we build mental maps of the code whiel reading it. Simplicity of Go allows for rules' formalization of how I build 3D mental map myself, so I can outsorce it to the code. I.e. the static code analysis tool that reads any Go codebase and visuzlies a 3D structure similar to how I would do it in my head anyways. By clearly separating spatial and temporal aspects of code, it's possible to blend this code visualization approach with editor and make it practical and helpful rather than just visualization excercies.
I paused the development, as I see the future of this project only in VR/AR environment, and I'm not sure this ecosystem is ready yet (it's a side project still). But honestly I dream about this tool almost daily, while coding with usual text code representation.
I’m about to start learning Go now. I tried it a few times before but I never got that ah-ha moment. I wanted to build a visual tool in the devops space, and go is prevalent so I need to learn it sooner or later.
But with your explanation, I see similarities to OCaml (which I love), where most of the work is modeling the domain by composing types.
I don't see how that's any different from reading Java/C#/Kotlin code honestly.
However, I did note that you lumped LabVIEW in with other visual "tools" and scripting tools. LabVIEW is a fully featured, general purpose language. You can do anything in it you can do in other languages, and there's plenty you can do in it that other languages can't. I don't know of any language that allows you to program desktop PCs, embedded high-level programs, real-time programs, and FPGAs with the same language. Maybe C/C++ with Vivado HSL. But...C/C++.
LabVIEW compiles to DFIR, an intermediate dataflow language, and then that compiles down to LLVM IR, which is handed off to LLVM. You can call .NET assemblies and C/C++ DLLs. It has value-based OOP, various (rather unique) implementations of polymorphism, built-in multithreading across cores, immutable data, a nice event structure for building GUIs, is highly performant, and a ton of other features. It has built-in support for basically any protocol (HTTP, TCP/IP, UDP, etc.), so it can talk to basically anything. If it doesn't have something built-in, you can obviously build your own or pull in some .NET or C/C++ dependency. So yes, you could rather easily write a raytracing engine or a GraphQL library in it. In fact, LabVIEW is damn fast, so it is great at things needing to be performant, especially if they can be parallelized.
LabVIEW is "specialized" to certain industries for three main reasons. (1) How well it ties in to NI's hardware and other test and measurement and scientific hardware. (2) It is expensive, but now there is a free Community version. (3) Non-acceptance amongst "mainstream" programmers of visual programming languages. So it actually has little to do with the language and more to do with factors external to the language.
There's a place for just wanting to see everything, but the beauty of graphs is abstraction. Sometimes if you are asking a specific questions, a small, beautiful graph might be a better way to answer the question, than just rendering a diagram with hundreds or thousands of objects.
Graphviz just provides a basic rendering service; it would be up to higher semantic layers to support such exploration. Also, no doubt, interactivity is essential. It would be good for some enterprise that has the incentives to support the work, to create a new system, or at least to extend Graphviz to support better interactivity. It is not such a big stretch.
Better in terms of? Style? Performance?
Trying to visualize your codebase with a format that is even more static and less navigable (a static image) feels a little contradictory imo
I found a small free library called MaintainJ that used aspect-oriented programming as you used the app. It was great to make sense of how everything was pieced together: You coul fire it up, run through a single scenario (user log in, add to cart...) and generate a flow diagram of just that scenario.
The library still exists, http://www.maintainj.com but I haven't used it in +15 years, so no idea how it is today.
Code + screenshots: https://github.com/johntellsall/shotglass#demo-django-a-bit-...
Sadly epydoc is no longer maintened and only supports py2. Had an idea of porting it to py3, but never found enough time to do so.
[1] https://repography.com/app/0/neovim/neovim/trunk/poster-surf...
Functions happen to live in the same file, but they can really be their own thing, especially pure functions. Even just having a tool to pick out pure functions vs state modifying functions would be great.
I want a graphical way to focus on each building block in a codebase that moves beyond the file format.
Anyone aware of efforts to pair these tools with tools to filter and examine different call paths to interactively explore a large code bases. A model like specifying a filter and having the view be filtered by paths that meet criteria.
godepgraph -s package | dot -T png -o depgraph.png
With: https://github.com/kisielk/godepgraphGitlab for example renders these if you tag a codeblock with "mermaid".
https://github.com/uxtely/ops-utils/blob/main/find-unused-de...
--
For monorepos, I check which files are shared between projects with:
https://github.com/uxtely/ops-utils/blob/main/show-interproj...