Gravity

November 30, 2021
tech writing

Our solar system formed from a cloud of dust and gas. Sometimes, gravity pulled together spectacularly large quantities of matter together, and we ended up with the Sun and the gas giants. Sometimes, the pull of gravity ended up forming something far smaller, like Pluto or Mercury. The asteroid belt? It’s the place where gravity wasn’t quite enough to coalesce matter into Yet Another Planet.

Gravity: it’s a big deal.

Our code has gravity. Each repository begins with a single line of code in a single file. Code accumulates. We write more to extend the functionality of our programs. And then, we find that we need to share some code between two repositories, and we have a choice.

We go one way, and each repository pretends it’s independent of the other, pushing and pulling that shared code to a central place such as a package manager. But they still perturb each other’s orbit. A backward-incompatible change in one repo causes the other to flex and change too. A feature request from one leads the other to change. They are independent, but tied, inextricably, by an invisible force.

We go the other way, and colocate code until we have a giant repository. A monorepo, or one of several überrepos. In a larger repo that invisible force is far stronger, because the code and the thing that depend on it are far closer. The same backward incompatible change that took a long time to spot when the repos were separate becomes visible instantly.

You see? Code has gravity.

Just like our solar system, that gravity leads to different outcomes. Sometimes, the gravitational pull is sufficient to pull almost everything into a single place. Sometimes, there are other forces at play that lead to the exact opposite outcome. Frequently, I’ve seen repositories start as independent bodies, and then, as their sizes increase and their interactions multiply, they come every closer together, sometimes merging. I’ve seen the opposite happen too. Repos figuring out ways of overcoming the gravity between the components and breaking out of the larger body to stand alone.

Our code has gravity. Our repos are caught in an endless dance, drawing closer, fragmenting, pulling apart, and then coming back together again.

More recently bzlmod Modules     Cloud Workstation Less recently

rules_jvm_external's New Maven-based Resolver

April 26, 2024
bazel tech

A New Approach to CI

September 5, 2023
bazel monorepo tech

There's No Such Thing as a Free Lunch

June 12, 2023
bazel monorepo tech