Live data from Hacker News

Ask HN: Visualizing software designs, especially of large systems (if at all)?

news.ycombinator.com

71–80 of 129 posts

Re: Ask HN: Visualizing software designs, especially of large systems (if at all)?

#71

I spent a number of years as a traveling consultant fixing problems... I guess it was aligned with what the cool kids call Site Reliability Engineering these days. Some company would have a crisis and I'd go in and fix it. So basically I had a matter of a few hours to learn as much as I could about some huge system that had probably been built over many years by a whole lot of people. To do this, I used a number of g…

> So basically I had a matter of a few hours to learn as much as I could about some huge system that had probably been built over many years by a whole lot of people

What are some of the open source tools that you are referring to? Within a few hours, I can imagine it being difficult to integrate and deploy your tools into an existing stack. But if you are tapping into some mirrored network port, that would make more sense.

Re: Ask HN: Visualizing software designs, especially of large systems (if at all)?

#72

Earlier quoted context omitted.

I use pen and paper as well, but rather than print out all the source code, I write down the call stack. A calls B calls C, etc. along with the line numbers of the call. Much easier than printing out the source and you still have the IDE niceties like go to definition, find in source, etc.

This reminded when I had to maintain dozens of old 10,000 lines COBOL programs as a junior programmer. I felt so lost I made a program that would print only the names of data structures and functions. Seeing the source resumed in a handful of pages, and being able to highlight and draw on it, helped me a lot. Digital has flexibility, but sometimes paper works best.

Paper is one of those Perfected technologies. It's been there for a long time but boooy. It's powerful

Re: Ask HN: Visualizing software designs, especially of large systems (if at all)?

#73
Any system, however complex, can be designed as a bunch of "I/O devices" with abstraction layers. The trick is to keep each abstraction layer simple enough so that you can hold it in your mind (or fit a piece of paper). With this approach any kind of visualisations tool would work just fine - from a piece of paper to tools like Ilograph. I personally prefer excalidraw.

Re: Ask HN: Visualizing software designs, especially of large systems (if at all)?

#74
> So, is it a good idea to try documenting the code design through some sort of visualization?

Yes, if it helps you understand how it works and how the pieces fit together.

No, if the previous is not all that useful for you (different types of learners), or you need to spend significant amounts of time doing it manually, especially given that code could change.

If you can, look into any tool that might allow you to get visualizations in an automated manner.

For example, JetBrains IDEs have a few different graph visualizations for dependencies and inheritance etc.: https://www.jetbrains.com/help/idea/2022.1/tests-in-ide.html...

There also used to be SourceTrail, though sadly the project is now retired: https://github.com/CoatiSoftware/Sourcetrail

For databases, you can also use external tools like DbVis: https://www.dbvis.com/features/

There are also a few tools here and there for visualizing networks or how container deployments look, but those are pretty situational/specific for each platform/setup.

Re: Ask HN: Visualizing software designs, especially of large systems (if at all)?

#75

Any system, however complex, can be designed as a bunch of "I/O devices" with abstraction layers. The trick is to keep each abstraction layer simple enough so that you can hold it in your mind (or fit a piece of paper). With this approach any kind of visualisations tool would work just fine - from a piece of paper to tools like Ilograph. I personally prefer excalidraw.

The "hold it in your mind" test is my gold standard. Certain minds can hold more or less at once, but we're talking about a narrow range.

The issue with modeling from any specific detail-specifying system is that the result is invariably outside that range, for some systems.

Model to a brain target, not a standard level of detail.

Re: Ask HN: Visualizing software designs, especially of large systems (if at all)?

#76
For OO structure, https://structure101.com is fantastic at global views, especially for refactoring, where it can help you plan how to transition from hairball to e.g., directed graph. It has a 30-day trial to show you it's worth the price.

Rolling your own visualization is useful and not too hard. It drives you to frame your questions more narrowly (call-hierarchy/sequence diagram, data flow, sub-systems?).

The fast-path for me is to generate the relation doublets/triplets (x --R--> y) and then let yFiles/yEd (https://www.yworks.com) lay it out hierarchically after converting to their tgf "trivial graph format". yEd GUI is free; the yFiles layout library is worth 10X the price if you're displaying lots of graphs.

Re: Ask HN: Visualizing software designs, especially of large systems (if at all)?

#77
You might find it helpful to distinguish between visualizing the design of the system being implemented by your software, visualizing protocols being implemented by your software, visualizing the design of your software implementation itself, and visualizing important implementation details at runtime, e.g. for debugging, profiling, and operations.

For visualizing system designs, you should take a look at STAMP, e.g., via “Engineering A Safer World” + the resources at mit.edu/psas + on YouTube.

(Multiple tools, both commercial and libre, exist and are being developed to make these diagrams, although for what it’s worth, I mostly hear about people making them using draw.io, Google Drawings, on physical paper/whiteboards, or occasionally with specialized tooling.

I have also recently published a project in this area, https://github.com/mstone/depict, which I believe is well on its way toward addressing some unmet needs here.)

For visualizing protocols, things like sequence diagrams, data flow diagrams, DRAKON flow charts, value stream maps, and occasional more specialized objects like CPSA “cryptographic protocol shapes” / strand space skeletons are where I start depending on the flavor of what’s needed.

For visualizing the design of implementations themselves, I have not yet seen anything that I feel obliged to recommend; rather, here, I suggest investing in adding illustrations to your existing documentation in whatever way is easiest for you to use to clarify whatever subtleties you need to clarify for your audience.

(Here I tend to look at things like ASCII-art, SQLite’s railroad diagrams (now made with pikchr, AIUI), and sequence diagrams, as mentioned by other commenters, as helpful examples to start with.)

Finally, for implementing debugging/profiling/operational illustrations, there is a such a rich set of examples to turn to — whether from the very specialized (custom process model video rendering pipelines in robotics) to TensorBoard for TensorFlow to general-purpose tools like browser performance debugging suites, flame charts, or Go’s built-in profile graphing tools - that rather than learn any particular such tools, I’d instead suggest trying to get comfortable with the building blocks underlying these systems, which include contemporary GUI/web apps, custom drawing and animation tools like SVG, pretty printers, and Grammar-of-Graphics systems like vega-lite.

(Note: although it may seem superficially extraneous to your question, the reason I also suggest thinking about debugging visualizations in this context is because IMO, to work, they ~necessarily encode a visual model of the design of your implementation since it is the design of the implementation that provides the vocabulary and relationships that have to be understood and navigated in order to successfully debug/optimize/monitor any given running instance of whatever system you are building.)

Re: Ask HN: Visualizing software designs, especially of large systems (if at all)?

#78

Earlier quoted context omitted.

Sounds like something the type system should have caught!

Lucky you if you work with people who see the value in a language with good type checking or that doesn’t just use strings for everything.

Is it really worth staying in a team that doesn't? Sounds like you'll spend more time fixing bugs than creating features.

Re: Ask HN: Visualizing software designs, especially of large systems (if at all)?

#79
Visualizations are just one aspect of documentation, so I would recommend looking into how you organize your documentation, and build visualizations to support that. This is, after all, what I think you are really going for: just better written explanatory documentation, with useful organization.

The divio system is a good place to start, IMO, when it comes to organization: https://documentation.divio.com/

So, I would treat a visualization used in an explanation-style document very differently from a reference guide. One is intended to illustrate a concept quickly, another is intended to be precise. I don't think you'll see a single "visual system" ever take over, largely because documentation can have very, very different goals for the reader.

Visualizations in reference guides are (unfortunately) rare. I happen to like the approach taken by project reactor, embedding visuals into java reference docs: https://projectreactor.io/docs/core/release/api/

Re: Ask HN: Visualizing software designs, especially of large systems (if at all)?

#80
In 15 years in the industry, the only UML I have seen outside of a classroom has been made ad-hoc, on a whiteboard during a discussion. There would usually be no strict adherence to whether a square or "blob" was a class, an object, a user, a database or a concept, nor whether a line between these with an arrow at the end meant "inherits from", "knows about", "has an instance of", "sends data to", "calls a function on", "contacts with a network request", "is transformed into" or something else - all these details would usually just be cleared up from the context, or with text next to the lines. There was thus also usually no strict distinction between class diagram, sequence diagram, flowchart or other diagram - the diagram would just be whatever it needed to be in a given area in order to convey the information being discussed. In short it was highly informal, and used as a means of communication or brainstorming, rather than documentation.

I have a feeling there might be more UML in parts of the enterprise world, or in places with "architects" that have forgotten (/never learned) how to code. But my guess is the above is what the majority of "UML" usage in the industry looks like.

As for your question about documentation: The best advice I can give is to be mindful that documentation tends to get outdated faster, the further away it lives from the code that it documents. That's why "self-documenting" code is so valuable, since the compiler will often refuse to compile it if you don't update it. Thus I would always advise to use the "closest" documentation form that is suitable, in roughly this order:

- The code itself

- The tests

- Comments in the code

- Comments at the start of files

- Readme.md

- Other files in repo

- Wiki that lives alongside the repo (e.g. GitHub)

- External wiki (e.g. Confluence)

In your specific case, it sound like you need to document the architecture/design in a way that needs to be understood before someone would even know which file to look in for further documentation. In that case, I would first attempt to describe the architecture in words in Readme.md. E.g. something like a list of the most important classes/functions/datatypes and a paragraph or two about how each relates to the others.

If something like that isn't helpful enough, and you want to make some UML consider using something like asciiflow.com or textik.com to make ascii diagrams to put in the readme. If the info doesn't fit that format, consider making diagrams in images that can be shown inline in the readme - ideally if you do this, use a format where you can also check in the "source" of the image (e.g. a graphviz DOT-file) to make it easier to update. And then finally, if all else fails, you can either check in a PDF, or use a wiki. But as mentioned above - prefer the "closer to the code" solution whenever possible.

Post reply on HN