Ask HN: Guidelines for making clear architecture diagrams
I’m new to making software diagrams. I come from a mechanical engineering background, and when drawing free body diagrams there is a set of conventions commonly followed to make a clear diagram. Is there such a set of conventions for software architecture diagrams? I googled briefly, but seem to be getting low quality articles, most of which are pushing a product :(
24 comments
[ 3.2 ms ] story [ 52.7 ms ] threadThe only diagrams I have seen in the last decade or two, though, have been Visio (or a similar tool) meant to explain the product's functionality (including where and how it scales) to customers, PS folks, etc
Reference for anyone looking I to it: https://c4model.com/
There is also quite a lot of options for helping create these diagrams. I've found https://structurizr.com/ to be the best of what I've tried so far.
There are definitely limitations, for me being able to encode and version control diagrams and system documentation alongside a codebase made the tradeoff worth it.
https://icepanel.io/
Also, PlantUML + C4 is like peanut butter & jelly:
https://github.com/plantuml-stdlib/C4-PlantUML
I'll gladly give up control of layout, and accept some ugliness, to never again have to worry about dragging boxes and arrows to be pixel-aligned, and then do it all over again when I add another box...
It looks like Mermaid has C4 support too:
https://mermaid.js.org/syntax/c4.html
Along the KISS principle, boxed elements with connecting lines are the best (simplest, most universally understood, least amgbiguous). In mathematical terms they are an 'undirected graph', a 'directed graph' is the same but with directionality ("arrows") on the links between nodes. https://en.wikipedia.org/wiki/Graph_(discrete_mathematics) The standard toolkit since at least 1991 for defining these in software is https://graphviz.org/
If you need to show the interaction between elements over time in a distributed or complex system, the standard is the message sequence chart https://en.wikipedia.org/wiki/Message_sequence_chart. The best (ie. most long term stable) tool for this be https://www.mcternan.me.uk/mscgen/ which is graphviz-inspired.
There are a plethora of latter-day derivatives such as web-native versions, stylized versions, etc. but these are all functionally irrelevant if you want to be clear, portable and maintainable. Lists of them are frequently posted to HN. The basic workflow is "want to communicate something", "define in text" (which can be done by code), "have image generated", optionally go back and refine.
<neckbeard-yells-at-cloud>The core problem with using web based services, as less experienced / more youthful respondents will suggest, is that they appear and disappear like the javascript frameworks they tend to be built on and thus are a poor match for nontrivial projects with potential medium to long term maintenance and availability requirements. The core problem with Visio and Visio-inspired solutions is that they are WIMP https://en.wikipedia.org/wiki/WIMP_(computing) based and thus tend to require manual clicking and placement which is tedious at best and totally unsuited to any at-scale / automation-related requirements.</neckbeard-yells-at-cloud>
There are also advanced features of these tools which can create complex diagrams like tabular protocol structure diagrams or database structure diagrams, clickable versions, color highlights, and SVG interactive diagrams.
If you want a codified set of rules that you can mechanically apply, I would look at UML and C4. However, I'd argue that the frameworks are overkill for the vast majority of engineering diagram use cases.
For the general scenario where you're just trying to communicate a technical concept clearly without spinning your wheels a lot, here are a few tactical things I'd recommend:
1. Pick the right diagram type for the job. Sequence diagrams are great for API documentation, ERDs are great for database schemas, flow charts are great for user flows, data flows and logical flows.
2. Use icons where possible. A database icon, a S3 bucket icon, a cylinder shape are all a lot more expressive and easier to grok than a rectangle with text inside that says "database".
3. Focus on the nodes, groupings, and connections. That's really all there is to a diagram if you break it down. If you just make a list of nodes, groups, and connections that you want to represent, the diagram will almost just draw itself.
4. If you're looking for a quick way to start jump start a diagram or looking for inspiration, try AI tools to see how far they can get you.
2. Strong disagree. IMHO icons in diagramming are obsolete for most purposes (smacking of UML and over-wrought database diagrams) and are likely to lead to confusion for the majority of viewers who - at best - aren't quite sure what you exactly mean in this particular case.
3. Which is what graphviz is for. It literally draws itself. Subgraphs are the groupings.
4. I would instead suggest modifying an existing graphviz .dot file, or man dot.
I don’t even see the text, I just see database, load balancer, Redis cache…
I like the idea of breaking down by Viewpoints and Perspectives, from the book Software Systems Architecture.
https://www.viewpoints-and-perspectives.info/
- Look into the C4 model - that is great for expressing architecture.
- Have a Miro board with multiple versions and working charts.
- Make at least one that reflects the full process, and one chart that reflects the relationships between components.
- Keep it simple, and avoid creating DoD style monstrosities. if you find yourself in that situation it means either you are mixing up recursion levels, or are not very clear on the purpose of the chart and the audience.
- Boxes and arrows are enough
- I personally have benefited from UML style charts, others hate them.
- Domain Driven Design and Event Storming style maps are also very clear way to express things.
- Most importantly - remember that an architecture is not a static thing, but a living, changing and ever-evolving thing. Like a garden.
The best i've ever used.