by js8 · 3y ago · 0 comments
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.
[1] https://www.youtube.com/watch?v=N7agCpAYp1Q
[2] https://en.wikipedia.org/wiki/Acyclic_dependencies_principle
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.