Our brains are pretty small, and many of the challenges we face are too big to fit into a small brain. What to do?
One nice trick is to break the big thing down into smaller things, until we have things that are small enough to fit into one brain. Once this is accomplished, we can begin to compose big things from these small things.
Compositionality is the principle that a system should be designed by composing together smaller subsystems, and reasoning about the system should be done recursively on its structure…
Compositionality is strictly necessary for working at scale. In a non-compositional setting, a technique for a solving a problem may be of no use whatsoever for solving the problem one order of magnitude larger.
(Jules Hedges, 2017, On Compositionality)
This approach has a number of advantages. When we break problems down into brain-sized pieces, we can grapple with them one at a time. We can even hand off different parts of the problem to different people.
Even better, when we divide a system into modules, we can forget about the insides of those modules. We can picture the module as a black box with inputs and outputs, and reason about inputs and outputs at this higher level of abstraction.
Clearly interfaces are a crucial aspect of compositionality, and I suspect that interfaces are in fact synonymous with compositionality. That is, compositionality is not just the ability to compose objects, but the ability to work with an object after intentionally forgetting how it was built. The part that is remembered is the ‘interface’, which may be a type, or a contract, or some other high-level description. The crucial property of interfaces is that their complexity stays roughly constant as systems get larger.
In software, for example, an interface can be used without knowing whether it represents an atomic object, or a module containing millions of lines of code whose implementation is distributed over a large physical network.
(Jules Hedges, 2017, On Compositionality)
Drawing lines allows for change
This divide-and-conquer approach works more often than you might expect. One reason is that nature evolves a lot of things that look kind of like modules.
Complex things, like animals, are recursively composed of simpler things, like organs, cells, DNA, genes, and basepairs. Why is this?
There once were two watchmakers, named Hora and Tempus, who made very fine watches. The phones in their workshops rang frequently and new customers were constantly calling them. However, Hora prospered while Tempus became poorer and poorer. In the end, Tempus lost his shop. What was the reason behind this?
The watches consisted of about 1000 parts each. The watches that Tempus made were designed such that, when he had to put down a partly assembled watch, it immediately fell into pieces and had to be reassembled from the basic elements. Hora had designed his watches so that he could put together sub-assemblies of about ten components each, and each sub-assembly could be put down without falling apart. Ten of these subassemblies could be put together to make a larger sub-assembly, and ten of the larger sub-assemblies constituted the whole watch.
(Herbert Simon, 1968. The Sciences of the Artificial)
Evolution favors systems that are made of free-standing sub-assemblies, sub-assemblies that can be put down, picked up, combined, and replaced at runtime without causing the whole system to fall apart. And this is another important thing about modules: they let us swap out parts of the system.
Lines are hard to change
When we draw a boundary, we restructure the connections between parts of a system. Boundaries sever connections, resulting in densely-connected islands, with loosely-connected bridges at the interfaces.
Relationships within each subsystem are denser and stronger than relationships between subsystems. Everything is still connected to everything else, but not equally strongly.
(Donella Meadows, 2008. Thinking in Systems)
The behavior of a system is defined by the structure of its connections, be it ant trails, neurons, or circuits. So, modules shape behavior by changing the structure of the system.
It matters where we draw the line.
Roads, once laid down, are rarely moved. Buildings go up. The city takes on the shape of the underlying boundaries. Boundaries set a system on a trajectory that is difficult to change.
Modularity is not without costs. An architecture’s visible information is not allowed to change during detailed design and is difficult to change later. Thus, modularity makes it more difficult to experiment on the architecture’s visible information (such as a module’s interfaces) in order to facilitate experimentation on the architecture’s hidden information (such as a module’s internals). In a way, the inflexibility of the visible information is the price for the flexibility with respect to the architecture’s hidden information.
(Barbara van Schewick, 2010. Internet Architecture and Innovation.)
So, where to draw the line?
Draw lines around uncertainty
We propose instead that one begins with a list of difficult design decisions or design decisions which are likely to change. Each module is then designed to hide such a decision from the others.
(Parnas, 1972: "On the Criteria To Be Used in Decomposing Systems Into Modules")
Since modules are black boxes, we can use them to hide uncertainty from the rest of the system. Seen this way, a modular system can be understood as an assemblage of uncertainties that have been boxed up and wired together.
Draw lines across time
Systems tend to sort themselves into pace layers, with different layers evolving at different rates.
We can find natural boundaries by thinking about time. Which parts of the system change quickly? Which will change slowly?
Pieces that evolve at different paces can become different modules, with stable interfaces between.
Let the lines draw themselves
To draw a line around an uncertainty, we must be certain about what is uncertain. To draw a line across time, we must know what is likely to change, and at what rate. We also need certainty about the interfaces themselves. Not just where they go, but what their shape must be.
So, drawing a line requires a deep understanding of what matters, an understanding that can only emerge with time and use.
Conditions for modularity:
Specifiability: The people or organizations working on both sides of an interface need to know which attributes of the component are crucial to the operation of the system, and which are not.
Verifiability: They must be able to measure those attributes so that they can verify that the specifications have been met.
Predictability: There can’t be any unpredictable interdependencies across the interfaces. People using the system need to get what they expect when interacting with the system.
(Modularity Theory, Christensen Institute)
Don’t force it! Forcing a boundary is costly. Tearing it up is costlier. Modules evolve quickly, but interfaces evolve slowly. Drawing a line means freezing a part of the system in time. If you draw the wrong line, you freeze the wrong part of the system. That parts of the system that need to evolve will no longer be able to evolve, making the whole system unadaptable.
This is why innovations tend to start out integrated, and get modularized over time. We draw the lines when we gain better understanding of where the lines should be.
Smartphones started integrated, with the iPhone, and were modularized later, by Android.
Cars started integrated, with the Ford production system, and were modularized later, by the GM production system.
Steel mills started integrated, and were modularized later, by mini-mills.
In a functioning market, modular boundaries will begin to emerge by themselves. Interfaces will form around areas of certainty. They embody the commodity part of the problem. Modules contain the remaining uncertainty, and therefore all of the alpha.
Profit arises out of the inherent, absolute unpredictability of things, out of the sheer brute fact that the results of human activity cannot be anticipated.
(Knight, 1921. Risk, Uncertainty, and Profit)
Market forces will try to get at the alpha by unbundling those black boxes into more boxes with new interfaces. With time, these modules begin to sort themselves into pace layers.
Where to draw the line?
Reflecting on all of this, I am reminded of the story of The Dextrous Butcher:
Prince Wen Hui’s cook
Was cutting up an ox.
Out went a hand,
Down went a shoulder,
He planted a foot,
He pressed with a knee,
The ox fell apart
With a whisper,
The bright cleaver murmured
Like a gentle wind.
Rhythm! Timing!
Like a sacred dance,
Like “The Mulberry Grove,”
Like ancient harmonies!“Good work!” the Prince exclaimed,
“Your method is faultless!”
“Method?” said the cook
Laying aside his cleaver,
“What I follow is Tao
Beyond all methods!“When I first began
To cut up oxen
I would see before me
The whole ox
All in one mass.“After three years
I no longer saw this mass.
I saw the distinctions.“But now, I see nothing
With the eye. My whole being
Apprehends.
My senses are idle. The spirit
Free to work without plan
Follows its own instinct
Guided by natural line,
By the secret opening, the hidden space,
My cleaver finds its own way.
I cut through no joint, chop no bone.“A good cook needs a new chopper
Once a year — he cuts.
A poor cook needs a new one
Every month — he hacks!“I have used this same cleaver
Nineteen years.
It has cut up
A thousand oxen.
Its edge is as keen
As if newly sharpened.“There are spaces in the joints;
The blade is thin and keen:
When this thinness
Finds that space
There is all the room you need!
It goes like a breeze!
Hence I have this cleaver nineteen years
As if newly sharpened!“True, there are sometimes
Tough joints. I feel them coming,
I slow down, I watch closely,
Hold back, barely moving the blade,
And whump! the part falls away
Landing like a clod of earth.“Then I withdraw the blade,
I stand still
And let the joy of the work
Sink in. I clean the blade
And put it away.”Prince Wan Hui said,
“This is it! My cook has shown me
How I ought to live
My own life!”(“The Way of Chuang Tzu”, Translated by Thomas Merton 1965)
When drawing lines, take it easy. Understand the whole before you cut it to pieces. Pause, listen. Let yourself be guided by the natural line.
Questions to ask myself when drawing a line:
Drawing a line around uncertainty: What is certain? What is uncertain?
Drawing a line across time: What is changing quickly? What is changing slowly?
Letting the lines draw themselves. Where should the lines go? Do I know? Am I forcing it? Can I pause and let the system tell me?