Live data from Hacker News

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

news.ycombinator.com

71–80 of 112 posts

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

#71
post #12

Even a few very basic UML diagrams (Use Cases, Class, Sequence) can form a very effective introduction to a system. I feel that people have just embraced Agile blindly and simply forgot about basic modelling.

>I feel that people have just embraced Agile blindly and simply forgot about basic modelling.

Very Good Point!

If you only look at things piecemeal and never holistically, the need for modeling and corresponding tools decreases.

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

#72
post #54
post #2

I find those diagrams a lot more confusing than just reading and having a mental model of the code.

It's a very valid criticism of diagram "systems" like UML. But, "read the code" doesn't scale. It makes it brutal when onboarding new team members who will not understand the "tao" of the system without a fireside chat with the original developers. And, usually, the OG devs are long gone...

The tao that can be sequence diagrammed is not the true tao, either.

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

#73

At the beginning of my career I worked for a company that was started with two reverse-engineering tools: one to produce low-level, single method/function flowcharts and another for automatic extraction of high level components and connections between them. It retired the former and later - the latter and pivoted to static analysis tools: finding logical errors, security vulnerabilities, enforcing coding standards. S…

What were the two tools used?

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

#74
Often these side artifacts turn into a make-work time-sink. Stuck on a hard problem? Distract yourself with a new ToDo app. Fix the auto diagram generator.

Honestly, freehand diagrams are best. You’ll exercise your own understanding of the code base as you draw.

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

#75

I've already mentioned this on the other thread ( https://news.ycombinator.com/item?id=31569646 ), but my friend and I have been working on https://www.codeatlas.dev as a sideproject - it's a tool for creating pretty (2D!) visualisations of codebases, while providing additional insights via overlays (e.g. commit density, programming language or other results from static analysis like dead code/test coverage/etc.). Fo…

[deleted]

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

#76

At the beginning of my career I worked for a company that was started with two reverse-engineering tools: one to produce low-level, single method/function flowcharts and another for automatic extraction of high level components and connections between them. It retired the former and later - the latter and pivoted to static analysis tools: finding logical errors, security vulnerabilities, enforcing coding standards. S…

What were the two tools used?

Not sure I understand the question but the two tools company started with were (1) visualizing control flow graph of a single method/function (2) extracting hierarchical components from directory or package structure and relationships between them (imports, includes, calls etc). The ones that ended up being used were byproducts of the “compilers” that we had to implement: finding logical errors and security vulnerabilities based on control flow and data flow analysis (pretty much what conventional compilers like clang and gcc do for code generation and optimization).

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

#77

> Why isn't diagram generation automated as part of the build process (UML or otherwise)? I vaguely recall Visual Studio has this option where you can generate some sort of class diagram. It looked like shit the last time I used it (~2019) especially as your classes get more and more functions built into it. I also can't imagine how shitty it looks for codebases that have a significant coupling problem. Furthermore,…

>It looked like shit the last time I used it (~2019) especially as your classes get more and more functions built into it. I also can't imagine how shitty it looks for codebases that have a significant coupling problem.

That's the point, right? Visually representing the complexity of the system. I've used IntelliJ to do this before to show why modifying certain behavior was so slow and error-prone. In that case there were 3-4 classes with heavily overlapping functionality because, surprise, in the past there were multiple teams contributing to the same codebase that all did their own thing.

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

#78
Diagrams are traditionally used during the design process, if they are used at all. I've seen sequence diagrams on some recent projects. Class diagrams and others? Not so much. Often such diagrams represent an idealistic view, lacking detail, and often deliberately disconnected from reality (otherwise, the diagrams would be a real mess.)

Also I have rarely seen diagrams generated from code, the main exception being database ERDs ("reverse engineering.") Usually, those diagrams are also a mess.

Also, I almost forgot to mention: with "Agile", there usually is no design process. We'll just "fix it in the next sprint."

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

#79
I made this node/tree editor 20 years ago: http://move.rupy.se/file/logic.html

It has been used for database schemas, game story creation, cutting up sprites among other things...

Lately I made my own node database so I don't need this tool any longer, but I'm sure it will prove useful eventually again!

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

#80
I think UML (etc...) was one of those things that look great on the surface but once you start diving deeper all the problems hidden under the surface become overwhelming. If a thing has been tried many times in the past and even with a lot of money thrown at it, yet it still disappeared into obscurity, then it's a pretty good sign that the idea wasn't great to begin with.

In practice it's the same problem as "noodle graph" visual programming. It works well in some niches (e.g. creating shaders in graphics programming, or sometimes describing AI tasks in game programming), but it completely breaks down outside those niches.

Post reply on HN