2 ms·
I think people get the modularity wrong. Modularity is important, but I came to conclusion there is another important architectural principle, which I call "sin
by js8 3y ago
I think people get the modularity wrong. Modularity is important, but I came to conclusion there is another important architectural principle, which I call "single vortex principle".
First, a vortex in a software system is any loop in a data flow. For example, if we send data somewhere, and then we get them back processed, or are in any way influenced by them, we have a vortex. A mutable variable is an example of a really small vortex.
Now, the single vortex principle states that there ideally should be only one vortex in the software system, or, restated, every component should know which way its vortex is going.
The rationale is when we have two vortices, and we want to compose the modules that form them into a single whole. If the vortices are correctly oriented, composition is easy. If they have opposite orientation, the composition is tricky and requires decision on how the new vortex is oriented. Therefore, it is best if all the vortices in all the modules have the same orientation, and thus form a single vortex.
This principle is a generalization of ideas such as Flux pattern, CQRS, event sourcing, and immutability.
- salvadormon 3y agoI find this vortex concept interesting. Do you have any books or online sources that I could use to study this?
- Freebytes 3y agoThis is a very good point, and you could probably write quite a few articles about this particular subject. You may even have a service A that calls service B that calls service C that calls service A. Then you have a problem. Or, you have C get blocked by something happening in A that was unexpected. Ideally, you only have parents calling children without relying on the parents whatsoever, and if you fail in this, you have failed in your architecture.
- andreygrehov 3y agoI think Robert C. Martin has already described that fairly well [1] [2]. [1] https://www.youtube.com/watch?v=N7agCpAYp1Q https://www.youtube.com/watch?v=N7agCpAYp1Q [2] https://en.wikipedia.org/wiki/Acyclic_dependencies_principle https://en.wikipedia.org/wiki/Acyclic_dependencies_principle
- porridgeraisin 3y agoI didn't quite understand your second-to-last paragraph(the rationale behind...), can you (or someone else) explain it further?
- samsquire 3y agoI like this. When I look at an architecture diagram, half the battle is trying to work out what is async/sync, push/pull and the direction of travel and ordering. Enterprise service buses and message queues are kind of solutions to the creating vortexes where there is not a matching direction on each side.