In the previous post, Kuzushi, I wrote of how the initial phase of a judo throw, where the judoka senses an imbalance in the opponent, is a form of a “middle way”. The term, “middle way” is a hash-taggy and therefore inadequate definition of the Buddha’s teaching. I said about Kuzushi:
Kuzushi is a middle way, but not as easy to implement as simply not trying too hard or trying too little. The middle way is a skillful way.
Likewise, software architecture has a notion of a middle way in the form of the balance between tight and loose coupling of software components. The skill is more complicated than turning a dial of coupling up or down. The skill is to recognize the boundaries around coherent functionality present in a domain, produce software components reflecting that functionality, and weaving it all together into a loosely-coupled mesh.
There is a definite art to this. It requires seeing where unstated boundaries and dependencies exist in order to cleanly partition a system into a set of independent and coherent parts. For example, a hotel has a customer-facing front desk, housekeeping, room service. Each part can operate mostly independently. The housekeeping manager is mostly autonomous in relation to the manager of room service. But there is still light but formal interaction between them.
Although I’m talking about software architecture and software development is my Zen art, this isn’t a “software developers only” post. This is a post about systems in general. Besides, the topic of loosely-coupled software systems is so complex, it’s well beyond the scope of a little blog. So, I’m just skimming the software aspects.
For the sake of this blog, it’s enough to understand that the environment in which we live is a system. It consists of geological processes, the evolution of species driven by constant change, the sapient activities of humans, and all the relationships between all of those things.
All creatures participate is some part of a web of food chains. Some species teamed together in a tightly-coupled relationship we call symbiotic relationships. Some are very picky eaters optimized for specific prey. Some are omnivorous, in a loosely-coupled relationship between many sources of food.
The Levers of Systems
Our human body which is our vehicle in this life is a system. The way we keep our homes clean is a system. The businesses we work at are systems. Life on Earth is a system. The Universe is a system.
Systems are composed of hierarchies of overlapping sub-systems, each with minds of their own and goals that are often in conflict with that of their fellow sub-systems. The bigger the system, the more exponentially complex it is.
For the design of software serving large systems (big enterprises), architects attempt to mitigate complexity by partitioning the enterprise into coherent, independent functions. The autonomous functions interact through well-defined protocols. These independent functions and protocols form a loosely-coupled system where each part can break or improve itself with little or no impact to the rest of the system.
The primary lever or dial in the hands of the system designer, the software architect, is the level of autonomy granted to each function. The dial ranges from 0 to “11”, pure autonomy to total top-down control.
There is a massive gray area between the anarchy of Lord of the Flies and the top-down totalitarianism of Stalin/Lenin. I wrote about a similar phenomenon of a universe of color between extremes of black and white in the Universe between #000000 and #FFFFFF.
For example, if we’re writing software for a restaurant, we could write one-big-package covering all that it takes to run a restaurant. It’s not a mortal sin for software to be all things to all participants. What is important is whether we can modify isolated parts as requirements change without inadvertently messing up other parts. Or will it require system-wide modifications, which increases opportunity for error?
Alternatively, we could first identify all the things that happen in a restaurant (greeting customer, identifying an open table suitable for the party, seating the customer, taking the order, receiving the order, etc.), code self-contained, independent, autonomous components for each, and link them together via well-defined messages.
The extremes of the those two approaches and everything in between amounts to a trade-off between flexibility and efficiency. Flexibility is preferred when things are in constant change, which is a big theme in Buddhism and Zen. Efficiency is preferred when things change slowly or not at all.
The Efficiency of Tight Coupling
The primary advantage of a centralized, monolithic system is that over time, incremental optimizations are feasible since everything is under the direct control of one umbrella. That god-like umbrella has the power to dictate the process of change. MBA types walk through the massive enterprise, identify inefficiencies, and design plans to rectify them.
In contrast, for a free-spirited distributed system the budding Stalin would need to negotiate so many compromises that effective change is forever elusive. Herding cats, as the saying goes.
We are prone to inadvertently building monolithic systems. Building monolithic systems sidesteps daunting upfront design that places future needs on par with clear and present needs. I suppose monolithic systems could be considered to be a design, but it’s one extreme along the continuum, turning the dial down to 0.
Of course, predicting future needs is more than tricky. There’s an infinity of possibilities. So we play around with scenarios and cull the infinity into a set of high-probability concerns that appeases the pragmatists and moderate dreamers in the group. Even though the bulk of those predictions will end up proving to be wrong.
Many of our systems aren’t purposefully designed as monolithic systems. Some cities around where I live started out as someone having built their home there in the wilderness a couple hundred years ago. Over time, others settled around there for the same reasons, and a patchwork of a city emerged. Nothing was planned, only attracted and assimilated.
The Flexibility of Loose Coupling
Loosely-coupled systems are comprised of independent parts that coordinate efforts towards a common goal. The independence of each part means each can be replaced, upgraded, or sometimes even removed without affecting the other parts.
If a changed part did affect other parts (i.e. there are dependencies between them), we are on the slippery slope of a muddy monolithic system. At some point down the slippery slope, the web of dependencies make it tough to evolve a system. In those cases, the engineers must tackle a nightmare of a project. Alternatively, instead of accommodating the force driving the need to evolve, that force is neutralized – which isn’t exactly a Bodhi way of conducting business.
The Internet is the best example of a loosely-coupled system. It consists of billions of loosely-coupled nodes. It is designed in such a way that it’s incredibly difficult to shut the entire thing down. Entire regions could be devastated, but the Internet would still run elsewhere.
If it seems like the entire Internet has been taken down a few times, that’s because we tend to forget that the Internet is more than just a handful of mega sites such as Facebook, Google, and Amazon. Sites such as those dwarf the massive number of other sites more than the mass of the sun dwarfs the combined mass of the planets, planetoids, and asteroids in its vicinity.
Along with other factors, the “Inter-Web” has lost much of its gooey web-like structure towards a hardened hub-and-spoke shape. So even the poster-child of a loosely-coupled system is not as loosely-coupled anymore.
The Duality of Systems
If it’s hard to grasp the notion of whether a system is tightly-coupled or loosely-coupled, it may be in large part due to the dual nature of systems. It depends on the pieces you’ve carved out, the lens you’re looking through, and your view point. For example, a car is sort of loosely-coupled in that we can replace or even upgrade parts without causing systemic effects. But it’s tightly-coupled in that when a part starts to falter, it can have a cascading effect on other parts.
Further, our automobile is tightly-coupled to the road system, petroleum industry, and environmental parameters (gravity, air composition, and temperature, etc.). Yes, we are trying to transform to “superior” systems of roads and fuel – which seems to imply a loosely-coupled system. But is it an expensive, painful, and decades-long processes – which implies a tightly-coupled system.
Our human body is an example of a tightly-coupled machine. If any organ fails, it sets off a cascade of failures in other organs. We’re tightly-coupled to the environment of Earth as well.
On the other hand, I work on software development teams where each of us humans are considered interchangeable parts. Surely, if anyone leaves there is a temporary hit to the system. But soon enough someone else is hired and onboarded, like a passing thunderstorm, that turmoil becomes a distant memory.
So is a human a tightly-coupled or loosely-coupled system?
Why do we consider ourselves each a relatively independent unit, a thing? Why do we readily recognize lions, tigers, and bears, or the planets of our solar system? These are things we’re taught to recognize by other people who were in turn taught by other people. But that doesn’t mean what we’re taught is the extent of things that exist. Nor does it mean the boundaries of the things we recognize are the actual boundaries. Countless things that we cannot see are there even if we can’t recognize them.
How Many Boxes Do You See?
We’ve all seen those drawings of triangles where we are asked to count how many triangles we see. It’s tricky because many triangles are made up of over-lapping hierarchies of sub-triangles and there are non-triangle shapes that throw you off.
The things that the sapient minds of our normal lives see and interact with are like the triangles we see in that picture above. Like the triangles, things we recognize during the normal course of our lives depends on where and how we draw a boxes.
Whether a system is tightly-coupled or loosely-coupled depends on where the box is drawn. Are there any inherent rules of the Universe for where boxes can be drawn? They can be drawn in infinite ways even beyond the physical constraints of space and time. That’s because the boxes are figments of our minds.
The boxes are only drawn with our minds and exist only there. And don’t think confirmation of the existence of something from your buddy makes it real. We all taught each other the same thing, so we generally train ourselves on roughly the same things.
So consider, then: What if no boxes are drawn? What do we see then? Emptiness. If we sapient humans aren’t here to draw the boxes, is the Universe a tightly-coupled or loosely-coupled system? Answering that takes us around in circles.
The Heart Sutra says, “… all phenomena bear the mark of emptiness …”. The Universe is empty of boxes. Infinite forms paradoxically is no form.
Redrawing the Box
“Thinking outside of the box” is well-known and very good advice and a fabulous tactic towards solving problems with elusive solutions. However, we can go further by redrawing the boxes. Those boxes, the things our minds have learned to recognize, morphs over time and may no longer be recognizable.
Systems churn. Everything is in constant change. Constant change is the fundamental axiom of Buddhism., after all.
It’s there whether we’re mindfully aware of it or not. That change might be so slow that it’s imperceptible to our senses. But sometimes change is imperceptible to our minds because it hasn’t yet learned to recognize the newly emergent things.
If our minds aren’t in the habit of redrawing the boxes, the disconnect between the model of the world in our brains and that of the real world widens. And so does our suffering. Alternatively, if it’s too much work to redraw boxes, then erase them all. Cultivate the wisdom of the empty cup.
I mentioned that boxes could be drawn across space as well as time. Meaning, it’s not like circling some area on a map of your city. Boxes could also be like events leading up to something like World War 2, which span space (different countries) and time (the events didn’t happen all in one instant). Innovation about relating things in novel ways.
The Skill of the Middle Way
The middle way is the skill of balancing and mitigating competing interests. One must always be vigilantly cognizant of gravitation towards extremes. For example, if some amount of money solved some problems, there is a mindless assumption that simply having more money will solve more problems.
Our humanly sapient lives revolve around systems – whether software, a manufacturing plant, a way of government, or our Earth environment. But these systems are boxes our minds draw around things so we can understand it (or at least think we understand it), and therefore control it.
The desire to control things is the “force” of our sapience, similar to how gravity is a force. But unlike simply describing gravity on Earth as 9.8 meters/second2, the possible effects of our sapience is marvelously varied and cannot be captured in a constant. The force of our desire results in different outcomes that wouldn’t happen in the Universe without the presence of the force of our desire.
Our sapience is both a force for making change as well as a force for resisting change. Without sapience, no boxes are drawn, so neither systems nor change exists. Enjoy your Gift of Sentience/Sapience while immersed in the comfort of knowing there is One ever-present Universe that goes by many names.
Bodhi Day is Soon
It will be Bodhi Day in a few days, this coming Wednesday (December 8, 2021). Through the recent posts on this site, you have an advantage over Prince Siddhartha when he collapsed under the Bodhi Tree before he could see through all the muck. You know the punchline going into Bodhi Day! But … you still may need to reverse-engineer the joke.
All of Life on Earth is a balance of trade-offs. It’s often not fun to be the thing being traded off. Meaning, today you may be the uke, the one in judo practice that is being thrown. As the uke, today you are the teacher of the tori, the one practicing the throw. In a minute, the favor will be repaid by switching roles. Know as well that there is a wealth of knowledge obtained in the role of the uke. This give and take reaps incalculable rewards for both the Yin and the Yang.
Like the drag of a fishing reel that doesn’t pull in a fish through mere brute force, through such sacrifices of give and take, Life on Earth perpetuates for another day for us to try something else. That is a trade-off I will take every day!
Faith and Patience to You,
Reverend Dukkha Hanamoku