Fork me on GitHub
#architecture
<
2022-08-14
>
niquola09:08:53

While making functional decomposition of the systems it worth to visualize the architecture. UML class diagrams can be used for datastructures! But I'm curious how do you draw the functions and interactions (calls)? Flowcharts? Blocks and arrows with params over arrows?

pithyless16:08:27

If we're not talking about specific implementations, but ideas about visualizing in general, I think Eric Normand's book "Grokking Simplicity" has some good insights to gleam. (I hope Eric Normand and Manning do not mind if I post 2 screenshots in a public forum).

pithyless16:08:20

It's always important to ask, what question are you trying to answer via visualization. 1. How do these functions/components depend or interact with each other? 2. Are there ways we can group sets of functions/components by commonality?

pithyless16:08:53

One way to answer these two questions is with a DAG visualization which identifies who is calling/depending on what:

pithyless16:08:50

The nodes can be considered functions/components; the rows are some way of grouping them together (eg. namespaces/subsystems); and the arrows are explicit dependencies. This way you can visualize: "are we building a system that goes from abstract to concrete?" (arrows should not be going up), "are we missing layers of abstraction?" (e.g. if an arrow is reaching down past many layers downward), "is this depending on too many things?" (too many arrows), "circular dependencies?", etc.

pithyless16:08:13

Another visualization is when you consider not the system at rest, but when it is in motion (things are calling other things: concurrency and time are possible culprits)

pithyless16:08:28

Timeline vizualization:

pithyless16:08:26

Here we are vizualizing that there may be things happening concurrently and we need to consider all permutations of when things happen (and we also vizualize points of forking and merging where we can simplify our reasoning and consider as if things were single-threaded; perhaps because results are independent or we can rely on specific concurrency primitives)

pithyless16:08:36

Not sure if that's what you were asking for @U0514TE0F - but perhaps it will help spark some solutions to your problem. And if this seems like a good direction, I recommend checking out Eric Normand's book "Grokking Simplicity" - he goes into a lot more detail on this subject :)

niquola16:08:22

Thank you! I'm thinkering about this. The idea is to visualize architecture based on functions/procedures not classes/objects. It's definitely gonna be blocks and arrows - question is how? I will share my version.

Eugen03:09:40

I wonder if something like polylith can help this visualisation. IMO seeing all functions can be a lot. Visualising polylith components via interfaces and their calls might be good enough middle ground. this could be some good tooling for polylith https://polylith.gitbook.io/polylith/introduction/polylith-in-a-nutshell .

Eugen03:09:50

poly tool has some basic cli visualisation based on deps . perhaps one based on namespaces and interface calls might be worth an investigation

tengstrand04:09:09

Good morning. When I think about dependencies in Polylith, it helps comparing the bricks (components and bases) with libraries, but as if they lived in one single shared mono-repo without the need of versioning. I think the main reason we sometimes create diagrams out of library dependencies, is because a library graph of dependencies often contains different versions of the same library, and that we sometimes want to sort out why the resolved version creates problems for us. If all the code/libraries were in sync (as in a Polylith workspace) we would not have that problem. A Polylith workspace is a place where we are in charge for how things change over time, which allows us to skip the versioning and instead work against the latest commit and at the same time feel some confidence that everything works together, that all our contracts (component interfaces) are fulfilled, that we don’t have any circular dependencies, and that the tests are green. When all this is assured, a graph will add less value to us. What’s important is instead which libraries and bricks we use. This is why the poly tool just lists the building blocks (components, bases, and libraries) in alphabetical order instead of showing them as a diagram (see https://polylith.gitbook.io/polylith/conclusion/production-systems). Just to be clear. I’m not advocating putting all the libraries in the world in a single mono-repo to get rid of the versioning. This would be almost impossible and not even desirable, and the tests would take forever to run!

karkunow11:09:16

Here is a nice talk about diagrams: https://youtu.be/HmHOYkTVxIg You can try use FC4 or C4 model to draw your flows: https://c4model.com/

👍 1
Alejandro08:02:21

Hey, @U0514TE0F. Have you found a tool that fits your needs?

niquola19:02:19

Hi, i did not find - drawing circles in figma for functions :)

Alejandro19:04:17

@U0514TE0F, have you tried the artist-mode in emacs? Diagrams can't be any closer to source code than that. Here's quick demo: https://www.youtube.com/watch?v=cIuX87Xo8Fc