sea's blog → Algebra, Lisp, and miscellaneous thoughts

Table of Contents

Integration and Encapsulation

Introduction

As you all know by now, I use Emacs as my operating system and life, and in fact, I'm part Emacs myself.

While I was trying to explain to someone why emacs is the greatest system we have available, I was emphasizing its sheer integration, as a unified wholistic environment where all parts operate as a system. I then realized that I've seen such things before, and in fact there is a more general phenomena that manifests this.

For any given 'system', you can represent it in some abstract space of "abstract components". The level of integration of those components determines if the system is tightly coupled, or loosely coupled, and both have advantages.

Software Packages versus Software Containers

For example, packaging your software as an rpm or deb package ensures that it cooperates well with the system. It integrates, it becomes part of the whole. Of course this also means that it's fragile in that if it breaks, a whole lot of other packages that depend on it might break as well.

Contrast this with software containers: You loose the integrated system, you can no longer share libraries or tweak one config file and have it apply to all aspects of your system at once, nor even can you use the filesystem as one whole (you have to bind mount into the container and so on), but in exchange you get portability and resiliency and a whole lot of reliability.

These are echoes of the same conflict: In the abstract space of software components, packages represent tight coupling and containers represent loose coupling and isolation.

The USA and China

I dislike politics so this part will be brief, but I observe that China is practicing the unified whole system philosophy, while the USA is a mess of autonomous "every man for himself" groups. it sure seems like the USA's primary philosophical bent is to keep everyone isolated from everyone else, and especially to keep the government out of your own business. Meanwhile China has the opposite approach: All are in it together, and the government is like a big daddy, ensuring that everyone gets along and "the rising tide lifts all ships".

Emacs and Vi

Emacs is the avatar of integrated systems. One whole, one process, (one thread!) and it does everything, and we really do mean everything. Emacs is my browser, my media player, my diary, my git client, my database client, my shell, and even my window manager sometimes!

Meanwhile, Vi (spits on the floor) is sort of a minimalist tool that calls other unix tools to do its tasks for it. It more represents the isolationist loosely coupled philosophy, though I observe that there's some kind of Vimscript now? I guess they're starting to integrate..

Complex Analysis and Algebra

In the complex numbers, functions that are differentiable have this bizarre and interesting property that they are one unified whole. Any small part of the function contains the totality of information on the function everywhere else. Analytic functions are intimately integrated with themselves at every neighbourhood of every point, and this absurdly strict coupling is responsible for their beautiful behavior and lack of paradoxical and nightmarish messes that you can have on real functions.

Meanwhile, in Algebra, these discrete components don't have such tight integrated relationships and you can have all manner of weird behaviors and sub-structures. Just figuring out what substructures even exist at all is a fascinating problem on its own, and you can view things as being composed of their different substructures, combined through different kinds of products and quotients and so on.

Centralization versus Autonomy

I suppose that it's similar to the USA and China section above, but this duality manifests in decision-making behavior. You can either have a centralized authority, tightly integrating all parts of your world, or you can have autonomous units kinda doing their own thing.

Note that centralization leads to fragility, if something goes wrong with central command, you're fucked. Likewise, in the autonomy situation, you've got a whole new world of distributed systems coordination and consistency problems, as well as the sheer overhead of all that communication and quorum-making.

Canada - Immigration - Integration versus Diversity

This duality appears in Canada in the differing views on what immigrants should do: Integrate into the system and become one with it, or remain somewhat autonomous and maintain their own individual cultural identity.

As with all the other aspects, both sides have drawbacks, and going too far in one direction can lead to either collectivism and all the problems it brings (mass hysteria and witch hunts) versus enclaves and all the problems they bring (gang wars and other such things, racism, etc.)

What Biology Does - Fractal Nested Alternating Layers

How does nature approach this problem of deciding which path to take? Well, turns out that nature tried to do both, by nesting the layers alternatively. You've got isolated organelles, integrated within cells which have isolation by their cellular membranes, integrated in a single blood and lymphatic system, isolated by the organism's skin/boundary, integrated within its pack/tribe..

Properties of either

Unity brings power and speed, but fragility. The tight coupling allows failures and 'bad things' to spread rapidly across the system. "Disease", for any abstract concept that behaves in a similar way, is extremely dangerous in integrated systems.

Isolation brings security, resiliency, and reliability. Consider how stable society would be if everyone ran off into the woods and was self-sufficient, but we wouldn't get much of anything done..we'd just sort of sit there, forever. Isolation also totally ruins the understability of the system and makes a real mess fo the mathematics that governs it, since you now have to account for all these complicated layers of interfacing that cropped up.

Monolith versus Microservices

You've read enough of this by now. Monoliths are integrated systems with all the associated benefits and downsides, and microservices are the opposite camp.

Imitating Nature - Fractal Nested Alternating Layers

If you try to imitate biology and make a nested monolithic micro-micro-service thing, though, then you get the benefits of both with neither of the downsides!

What would that look like?

Well, you've got a monolith, but it has somewhat autonomous modules within it, and those modules are themselves monoliths with their own little modules, and so on all the way down..

Or you start on the other end: A microservice architecture, except you've only got a handful of them, and they're not very 'micro' any more, they're huge. This, of course, is just the big cut-up system that you get like GItlab or Postgresql with its replicated systems: Only a handful of servers but they're freaking huge.

Both lead to the same structure: The beneits of both isolation and integration, with minimal downsides.