Skip to content

Comment on Ask HN: Why aren't code diagram generating tools more common?

Comments

I'm surprised no one's mentioned Simulink, LabVIEW, Pure Data, and GNU Radio where your code is the graph.

Sticking to the spirit of the question, I will categorize the tools mentioned in the comments. They solve very different problems, so the "ideal tool" absolutely depends on the task at hand. I think this rough categorization can help to select the right tool for the job.

The first class of tools are drawing tools. These tools aim to aid design and communication. plantUML http://www.plantuml.com/ is best suited to manual use. I use plantUML when sketching out designs. It's great for thinking about and communicating state machines, system architecture, and server-client or multiprocess interactions. The problems solved by plantUML can also be solved by general GUI diagramming software like Visio or LibreOffice Draw. I'll not dawdle on the pros and cons.

A second class of tools are static analysis tools. These are more of a microscope than they are a sketch pad. They operate on existing code and the user input comes as filters or options to get the desired level of detail. The examples here all produce graphviz .dot files:

bazel query for dependency graphs - https://bazel.build/docs/query-how-to

Doxygen C call graphs and struct inheritance graphs - https://www.doxygen.nl/manual/diagrams.html

radare2 generates call graphs from an .elf file - https://reverseengineering.stackexchange.com/a/9120

A DBC visualizer (CAN bus protocol specification file) - https://github.com/driftregion/dbcview (mine)

These tools are great not only for probing the depths of an unfamiliar codebase but also because they give insights to people already familiar with that codebase. For example: statically generated callgraphs showed that some debugging hooks had been left in. They've also shown duplicate code paths.

A third class of tools mentioned in the comments are dynamic analysis tools: profilers, tracers, debuggers. These are the oscilloscopes and signal analyzers of software engineering. These seem to be outside OP's query.

Why isn't diagram generation automated as part of the build process (UML or otherwise)?

The output of class 1 and 2 tools is used in builds. Doxygen supports plantUML (class 1) and callgraph generation (class 2). Class 1 is obviously manual, and class 2 is also manual for reasons that others have mentioned here: namely adjusting to get the right level of detail. The text output of class 3 tools is often used in CI as a pass-fail indicator.

Why aren't code visualization tools more popular? The options out there seem outdated.

My anecdotal experience is that these tools are specialized and therefore have a small audience. They solve problems related to design and analysis of software which is a small part of "real world" (sorry) software development.

edit:formatting

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.