Wednesday, 2 December 2026

Petclinic Through the Real Pipeline: What Held, What Changed, and What Did Not

In Phase 1, we ran all eight exploratory Petclinic datasets through the scripted pipeline (step03 to step07). Each dataset compares Spring and OfficeFloor solving the same problems under four agent strategies. Then we placed the new numbers beside our earlier scratch scripts in results/phase1/COMPARISON.md.

Phase 1 uses stricter definitions than the scratch scripts. Sinew now measures return to core members beyond chance (cores.py). H3 is tested within a class. Forced code ignores dependency injection because a field is a field. Handlers are removed. Following the study's rules, findings against OfficeFloor and against our hypotheses sit right beside the ones that support them.

1. The picture: same amount of code, very different places

Across all eight Petclinic datasets (results/model/<dataset>/REPORT.md), Spring and OfficeFloor wrote about the same amount of new code per problem. The Spring over OfficeFloor ratio of new code per problem (S1) ran from 0.73 in petclinic-just-solve-202608081920 to 1.02 in petclinic-impact_gated-202609010045.

Where that code landed stayed very different (results/phase1/COMPARISON.md and REPORT.md).

  • Top three class share (S1). Concentration in the top three classes was 1.46 to 3.23 times higher in Spring across the eight datasets. In petclinic-just-solve-202608100006, top three share was 0.80 in Spring and 0.25 in OfficeFloor. Effective classes were 4.12 in Spring and 26.04 in OfficeFloor.
  • The method level (D4). A fair critique of OfficeFloor is that a single function class in OfficeFloor looks like a method in Spring. If you count methods instead of classes, the gap shrinks a lot. OfficeFloor placed 90% to 97% of new lines into new methods, compared with 74% to 91% in Spring. Top three share over methods was 0.03 to 0.09 in OfficeFloor and 0.08 to 0.30 in Spring. The study tests encapsulation at the class level and reports method spread beside it as shape (PLAN.md §11 row 23).

2. Births (H1) and the simulation (H8)

The clearest and steadiest difference across all eight datasets is how often each form opens a new class.

  • H1 (odds of a new class, Spring vs. OfficeFloor). The odds ratio ran from 0.03 to 0.52 across all eight datasets (p = 0.005 in every one, passing Holm in all eight). In petclinic-just-solve-202608100006, OfficeFloor's birth rate was 0.64 (0.70 on additive units, 0.45 on mutative units). Spring's birth rate was 0.14 (0.15 additive, 0.10 mutative).
  • Swapping births in simulation (H8). In petclinic-just-solve-202608100006, giving Spring OfficeFloor's birth rate moves simulated effective classes from 5.93 (4.74 to 7.32) to 30.23 (21.37 to 38.17). Giving OfficeFloor Spring's birth rate drops it from 53.02 (42.73 to 60.99) to 9.41 (7.04 to 12.22).
  • Where the model falls short. The simulation makes both forms spread out too much compared with reality. It simulates 53.02 effective classes against 26.04 observed in OfficeFloor (2.04 times higher). In Spring it simulates 5.93 against 4.12 observed (1.44 times higher). Births and the four core forces miss how much the problem itself points new code back to the same classes. The extended fit confirms this, giving problem relevance a weight of 3.72 in OfficeFloor and 1.65 in Spring in just-solve-202608100006.

3. Size, sinew, the loop, and black holes

Here is what held across the eight runs, followed by where the numbers did not go our way.

  • Black holes by volume (H4). Spring minus OfficeFloor black hole volume share was 0.00 in the short 20 checkpoint 202608011310 run and 0.30 to 0.66 across the seven 60 checkpoint runs. It passed Holm in 5 of 8 datasets (p = 0.005 to 0.020). In petclinic-just-solve-202608100006, Spring's black hole volume share was 0.66 (with 0.55 in the single largest black hole) against 0.00 in OfficeFloor.
  • The loop (H7). In Spring, forced placements gained 0.41 to 0.93 more sinew than chosen ones (p = 0.005 to 0.020 in 7 of 8 runs). In OfficeFloor, the gap was -0.07 to 0.07 (p = 0.368 to 1.000, never passing) because OfficeFloor rarely built sinew over 60 checkpoints.
  • Size (H2) and direction (S3). Size pulled harder in Spring in 6 of 8 runs (0.06 to 0.84 weight difference). However, it went slightly the other way in impact_gated-202609010045 (-0.20) and cohesion-prompt-202609160027 (-0.22). Cross lagged S3 (forces leading shape minus shape leading forces) was positive (p = 0.005 to 0.015) in 7 of 8 OfficeFloor runs (0.11 to 0.19) and 6 of 8 Spring runs (0.05 to 0.09).
  • PMD God classes. In Spring, between 9% (impact_gated-202609010045) and 100% (just-solve-202608081920) of black holes were flagged PMD GodClass at the end. In just-solve-202608100006, 45% of Spring's black holes that were clean at the 60% split became God classes by the end. Only 8% of similar sized non black holes did (difference 0.37, p = 0.010).

Two big warnings: H3 within a class and S2 forecasts

Two findings cut against a clean story. Both shape what happens next.

  1. H3 within a class mostly failed to pass on 60 checkpoints.
    In the old scratch scripts, the pooled sinew slope looked strong in Spring (0.38 to 1.46 here too). Once we tested within a class instead (PLAN.md §11 row 10), the picture changed.
    • In Spring, the within class sinew slope ran from -0.24 to 0.42. Seven of eight intervals crossed zero. Only cohesion-prompt-202609160027 passed on its own (0.29, p = 0.015), and not after Holm. Among changes that also edit a class's own lines, the slope was noisy or negative (-0.85 to 98.92).
    • In OfficeFloor, too few classes had sinew. The slope was not estimable in 3 runs, strongly negative in just-solve-202608100006 (-15.00), flat or negative in 3 runs (-0.33, -0.10, 0.28), and positive in impact_gated-202609031757 (1.13, p = 0.008).
    • What this triggers in Gate 2 (PLAN.md §8.5). Sixty checkpoints of Petclinic are too short to settle H3 within a class. By the pre written Gate 2 rules, H3 now depends on whether the long open source histories in Phase 2 (open-source-explore) show a clear positive slope.
  2. S2 held out forecasts lost to single metrics in OfficeFloor, and often in Spring.
    • On H9, shape added almost nothing over the forces (-0.44 to 0.02 of the forces' gain over guessing, p = 0.005 to 0.015 in all 8 runs and both arms).
    • On S2 (where held out code goes), the best single metric beat the forces model in all 8 OfficeFloor runs. Forces minus the best metric was -0.10 to -0.29 log probability per choice, reversed in 7 of 8 runs. In Spring it was negative or near zero in 5 of 8 runs (-0.79 to 0.10). In just-solve-202608100006, metrics (-3.601 OfficeFloor, -1.518 Spring) and mass alone (-3.622 OfficeFloor, -1.821 Spring) outscored the full forces model (-3.682 OfficeFloor, -1.873 Spring). Adding sinew to change count helped Spring's forecast in 6 of 8 runs (+0.06 to +0.43, p = 0.005), while adding 0.00 in OfficeFloor (p = 1.000).

4. What changed from the exploration and why

Putting exploration/petclinic/ beside the real pipeline (results/phase1/COMPARISON.md) showed two clear patterns.

  • Physical outcomes held closely. In just-solve-202608100006, Spring's top three share was 0.80 vs 0.80, and OfficeFloor's was 0.24 vs 0.25. Effective classes were 4.00 vs 4.12 in Spring and 27.20 vs 26.04 in OfficeFloor. Births were 0.13 vs 0.13 in Spring and 0.61 vs 0.64 in OfficeFloor.
  • Model weights shifted where bugs and definitions changed. Fixing the set likelihood bias and dropping the single endpoint handler term raised choice weights sharply. In just-solve-202608100006, choice home rose from 0.29 to 1.15 in Spring and from 0.50 to 4.29 in OfficeFloor. OfficeFloor's choice volume flipped from -3.70 to 0.52 once shape stand ins left the core fit. Redefining sinew shrunk Spring's event horizon from 9.20 to 4.48 and moved OfficeFloor's forcing sinew from 1.07 to -14.30 because almost no OfficeFloor classes built a core.

5. Sinew from change alone: gas clouds, single cores, and several cores

Gate 5 in PLAN.md §8.5 asked a sharp question. Is our new definition of sinew (cores.py) just mass in disguise?

Phase 1 gave a clear answer.

  • The shuffle test is clean. We kept each class's exact mass and shuffled which members each change bound at random. Sinew collapsed to 0.00 to 0.02 across all eight datasets in both forms. Compare that with real Spring sinew of 0.14 to 0.55 among classes with enough changes to tell. Returning to core members is real structure, not raw change count.
  • Mass explains less than half of sinew in most runs. R² of log sinew on log mass in Spring was 0.25 to 0.53. Seven of eight runs sat below Gate 5's 0.5 cutoff, with cohesion-prompt-202609160027 at 0.53. In OfficeFloor it was 0.07 to 0.36.
  • Class kinds at the end. In OfficeFloor, 77% to 100% of evolving classes were gas clouds (no core), 0% to 4% were single core, and 0% had several cores. In Spring, 43% to 74% were gas clouds, 12% to 52% were single core, and 0% to 3% had several cores. In just-solve-202608100006, 94% of Spring's black holes had a single core (6% had several cores and 0% were gas).

What this means next

Phase 1 confirmed the birth gap (H1), the dispersion gap (S1), the black hole volume gap in 60 checkpoint runs (H4), and that sinew captures genuine core re use rather than mass. At the same time, it left two big open questions before any freeze. H3's within class slope was too weak or noisy over 60 checkpoints to confirm, and S2's placement forecast lost to simple metrics and mass in OfficeFloor and most Spring runs.

Next is Phase 2 (open-source-explore). We are now measuring 283 real open source Java repositories with long commit histories to see whether within class forcing and the forces' forecast edge appear over real timelines.

Building the Measuring Stick Before Looking at the Data

An AI coding agent adds features and fixes over dozens or hundreds of changes. Where does the new code land? Why do a few classes end up swallowing almost everything near them?

That is what this study asks. To keep it concrete, we use a physical picture. Every word in it is a measured number.

  • Births. Opening a new class for new code instead of adding to an existing one.
  • Mass and size. How many earlier changes put code in a class, and how much code sits inside it.
  • Sinew. Repeated changes to a class keep binding to the same core fields and methods. It happens more often than chance would explain.
  • Forcing. New code binds to a class's own members. Once it touches that class's state or methods, it could not easily live somewhere else.
  • The loop, event horizon, and black hole. Suppose sinew raises the odds that arriving code is forced. Suppose forced code adds more sinew. Past an event horizon, half of the arriving code is forced. The class becomes a black hole that pulls in nearly everything near it.

We test two forms of code on the same problems. Spring uses handlers and methods. OfficeFloor uses function injection, which opens new classes for new functions. Alongside that comparison, we test forecasts. Can these forces predict where code goes and which classes turn into black holes better than code shape and quality metrics?

Why build and lock the pipeline first

In an earlier study (placement-gravity-study) and a later Petclinic exploration, we built the hypotheses after looking at the data. Looking at data to invent hypotheses proves nothing if you test them on the same data.

So for this study, the confirmatory data are locked in the code. runs.yaml marks the confirmatory datasets as confirmation. Those are ui-primary for Paper A, and open-source-human-confirm and open-source-agent for Paper B. The scripts refuse to fetch, measure, fit, or even list them until a manual git tag named plan-v1 is an ancestor of HEAD.

Phase 0 builds the measuring and modelling pipeline first. Then it tests the pipeline on synthetic worlds where we already know the true numbers.

How we know the model and tests work

step02_selftest.sh ran four checks. All results come from labnotes/briefs/phase0.md.

1. Automated tests and the code lock

From results/selftest/TESTS.md, all 33 tests passed in 167.78s. There were 2 RuntimeWarning overflow messages in placement_choice/model/fitting.py. The suite includes the test proving the lock blocks confirmatory data before plan-v1.

2. Recovering known forces

From results/selftest/recovery/RECOVERY.md, we generated 100 synthetic datasets of 10 chains each. Each dataset came from known birth, choice, and forcing weights. We ran them back through the measurement pipeline (placement_choice.model.recovery) and fitted the model. A parameter passes when its 95% interval covers the true value at least 85% of the time, targeting 95%.

All 14 checks passed.

  • birth.one had true value -1.0. Mean estimate was -0.991 with coverage 0.940.
  • birth.mutative had true value -0.5. Mean estimate was -0.504 with coverage 0.960.
  • choice.mass had true value 1.5. Mean estimate was 1.491 with coverage 0.890.
  • choice.size had true value 0.5. Mean estimate was 0.505 with coverage 0.950.
  • choice.home had true value 0.7. Mean estimate was 0.725 with coverage 0.950.
  • choice.sinew had true value -0.3. Mean estimate was -0.307 with coverage 0.920.
  • forcing.sinew had true value 0.6. Mean estimate was 0.592 with coverage 0.950.
  • forcing.mass had true value -0.3. Mean estimate was -0.305 with coverage 0.940.
  • loop.forced_minus_chosen must sit above 0. Its mean was 0.601 with SD 0.235.

This check caught a real bug from our earlier Petclinic exploration. Sometimes one checkpoint places new lines into several existing classes at once. The exploration treated the other chosen classes as rejected alternatives. That biased every choice weight toward zero. Replacing it with a set likelihood summed over drawing orders removed the bias. This is recorded in PLAN.md §11 row 5.

3. Testing the tests where there is nothing to find

From results/selftest/size/SIZE.md, we ran placement_choice.model.size on 100 synthetic datasets per world. Each dataset had 10 chains per arm and 200 bootstrap draws. A test fails the check if it passes in more than 10% of runs.

  • A world with no force. Here sinew does not raise forcing, while each class keeps a lasting leaning of its own (SD 1.5 on the logit). H1 passed in 7.0%. H3 within a class passed in 7.0% on the first arm and 0.0% on both arms. H4 passed in 0.0%. All passed the check.
  • Why pooling classes fails. We also ran the old pooled slope beside the table. It mixed differences between classes with changes inside a class. It falsely passed in 23.0% of runs. That is why H3 now tests within a class (PLAN.md §11 row 10).
  • A world on the edge of the band. Here the first arm's sinew slope is 0.8 of the second arm's. The H3 "one law" test passed in 0.0%.

4. Checking the Python fit against R

From results/selftest/crosscheck/CROSSCHECK.md, we fitted the same conditional logit data in Python and in R using survival::clogit and mclogit.

  • mass was 1.397081 in all three, with SE 0.161326.
  • size was 0.415097, with SE 0.137825.
  • home was 1.330063, with SE 0.472059.
  • sinew was -0.369249, with SE 0.122586.

The largest gap was 4.02e-09 on estimates (tolerance 0.0001) and 1.95e-10 on standard errors (tolerance 0.001).

What comes next

The pipeline passed every synthetic check. This brief ran on a dirty tree at commit e68b0f770, so we will rerun on a clean commit before registration. Next is Phase 1. We run all eight exploratory Petclinic datasets through the real pipeline using ./step03_pin_chains.sh through ./step07_phase1_report.sh. That will show what holds, what changes, and what needs work before looking at open source histories.

Sunday, 29 November 2026

Placement gravity, closed: what petclinic showed, and the forces it pointed to

Placement gravity was registered to ask whether new code gets to choose where it goes, or is pulled into the place that already holds its data. I've now read its petclinic replications, and I'm closing the study as registered. Its main test, the OfficeHQ runs, hasn't been read. It goes to a new study, still unread, with a plan that will be registered before anyone looks at it. This post covers what petclinic showed, what I found when I looked at the same data a different way, and why that's a new study rather than another revision of this one.

What the registered tests said

Petclinic was never the main test. It's a replication: one application, 60 change requests, grown by the agent under Spring and under OfficeFloor, with seven sets of runs readable for a verdict (four agent conditions, some repeated). Each set of runs is decided on its own. Here's how the hypotheses fared across the seven:

  • H1, the force. Not supported in any of the seven. OfficeFloor was forced less in every one: half-way through the stream, its rate of forced placements was between 0.06 and 0.53 of Spring's. But the hypothesis also said the gap would widen as the code grew, and it didn't. It narrowed. OfficeFloor's forcing caught up as its code grew.
  • H2, a core draws code in. Supported in four of seven.
  • H3, the encapsulation fills. Supported in six of seven, reversed in one.
  • H4, function injection forms no core. Supported in three of seven.
  • H5, surface against volume. Reversed in six of seven, not supported in the seventh. For the same amount of logic, OfficeFloor added more link weight than Spring, and the gap grew. That's the drift I described from the practice chain: the agent writing OfficeFloor helper methods that call each other. It was real, and it held in the replications.
  • H6, shape does not draw code in. Supported in four of seven; the rest unresolved or not supported.
  • H7, co-change spread does not see the force. Unresolved in five, not supported in two.

Every verdict, with its intervals, is in the study's results index, produced by its scripts. Taken together, they don't support the study's story as it was written. Some parts held (the encapsulation fills; forcing is lower with function injection), and the central claim, that the gap widens, failed.

There's also a limit I should have weighed more. Petclinic sends every rule through one endpoint, POST /api/owners. One handler in one controller receives nearly everything. It's a weak place to learn how code spreads across many handlers.

Looking at the same data differently

After the verdicts were in, I asked a different question of the same data: not "how often is code forced?" but "each time new code is written, which class does it go into, and why?"

That's a choice among every class in the codebase, and there's a well-known model for choices: McFadden's conditional logit, from econometrics, built in the 1970s to predict how people choose between ways to travel. Each option gets a score from its features, and the chance of choosing it follows from the scores. The well-known "rich get richer" model of network growth, preferential attachment, turns out to be its simplest case, with size as the only feature. So the model lets several forces compete for each placement and says how strongly each one pulls.

I'm describing this carefully, because it's exploration after the fact. I built the model while looking at these data, so nothing below supports anything. It's where the next study's hypotheses come from. The numbers come from scripts kept with the new study, and they'll be regenerated by its full pipeline before they're relied on.

  • The problem sets the amount; the form sets the place. Both frameworks added about the same code per change request (Spring's amount was 0.80 to 0.97 of OfficeFloor's). But Spring put 71 to 87% of it into its top three classes, against OfficeFloor's 23 to 31%.
  • Births. When new lines went into a class, Spring opened a brand-new class only 12 to 15% of the time. OfficeFloor did so 54 to 64% of the time.
  • Mass. Where new code went was led by where earlier code had gone, in both frameworks.
  • Sinew forces. The more of a class's fields and methods earlier code was tied to (its sinew), the more likely new code arriving there was forced. The slope was about the same in both frameworks. And a forced placement added five to thirty times as much sinew as a chosen one, so the two feed each other.
  • Swap the births and you swap the frameworks. Simulating each framework with the other's birth rate swapped their concentration: Spring spread out, and OfficeFloor bunched up.

If that holds up, it changes where I'd say function injection helps. It doesn't seem to change the law by which sinew forces code. It changes how often new code starts somewhere new, so fewer classes ever gather enough mass to fall into that loop.

Why a new study, not another revision

I could have amended the plan again. I don't think that would be honest. The new model isn't a tweak to a hypothesis. It's a different question, and I found it by looking at data the old plan had already been read on. Amending a registered plan around what you've just seen is exactly what registration is meant to stop.

So the old study closes as registered, with its verdicts as they stand, including the ones against OfficeFloor. The new one starts from a clean plan, and its confirmatory data are the OfficeHQ runs, which have still not been read, plus open-source samples nobody has looked at.

The new study: placement choice

The new plan is written in the language of physics, because each word is a measured quantity:

  • Birth: new code opening a new class.
  • Mass: how much code a class has gathered, and how often new code has gone there before.
  • Sinew: the data of a class that the code in it is tied to.
  • Forced: new code that had no other class it could go into.
  • The loop: sinew forces code in, and forced code adds sinew.
  • The event horizon: the point where most new code reaching a class is forced. Past it, the class is a black hole.

It also makes a claim against the usual way of judging code. Shape and other code-quality metrics (long methods, complexity, coupling, god-class rules) describe the shape of the solution after it has formed around its problem. The forces are what cause concentration. So the study tests whether the forces forecast where code will go, and which classes will become black holes, better than the quality metrics do.

There are two parts, planned together and registered once:

  • The physics of placement, on the OfficeHQ runs (Spring against OfficeFloor, ten chains each, 250 change requests): births, the pull of mass, sinew forcing under both frameworks, and how many classes pass the event horizon.
  • Forces, not shape, on open-source histories: whether the forces forecast black holes better than size or change hotspots, and better than the quality metrics.

How it will be run

Everything runs on the exploration data first, through the same scripts the real data will go through. That way the code and its results are tested where a mistake costs nothing:

  1. Build. The pipeline and its tests, including fitting data simulated from known forces and checking the model gets them back.
  2. Petclinic. The exploration above, rerun by the real scripts. Its numbers must come back, or each difference gets explained.
  3. Open-source exploration. A first sample of histories.
  4. Freeze. The open decisions settled, and the plan tagged. That's the registration.
  5. Confirmation. The OfficeHQ runs, then the confirming open-source samples.

There'll be a lab note like this one at each step. Every number in them will come from a script's output, with the file named, and each output will record the commit, the inputs and the seeds that made it. The lock on the confirmatory data is in the code: the scripts refuse to read it until the registration tag exists.

Guarding against myself, again

I created OfficeFloor, and this note is about a study whose central claim failed. Moving on from it could look like walking away from a result I didn't like. So, to be clear:

  • The old study's verdicts stay published as they fell, including H5, where OfficeFloor did worse.
  • The new hypotheses came from exploration and are labelled that way. They're only tested on data nobody has read.
  • One of the new study's main hypotheses predicts no difference between the frameworks: that sinew forces code by the same law in both. If OfficeFloor turns out to escape that law, the hypothesis fails.

The old study, its plan and every result are in placement-gravity-study. The new plan, still a draft, is PLAN.md in placement-choice-study, with the exploration it came from beside it.

Thursday, 26 November 2026

Placement gravity, revised: encapsulation is the force and method calls are the cost

Ten days ago I registered a study asking whether new code gets to choose where it goes, or is pulled into the place that already holds its data. The next day I took the registration back down. Working through the practice data showed I hadn't yet found what was doing the pulling. This post covers what changed, what the study now predicts, and how I've made sure every number in it comes from a script rather than from me.

Why the registration came down

A study registered before its data only means something if the plan is finished when it's registered. Mine wasn't. On the practice data, one chain per framework set aside from the analysis, the measures kept saying the same thing: code wasn't drawn to big methods or to complicated ones. It was drawn back to a small number of values that were private to one class.

So I removed the tag before any of the real runs had been read, and kept working on the practice chain. The scripts still refuse to read anything else until the tag is set again. Every change since is listed in the plan, dated, with what I'd seen when I made it. There are 112 numbered revisions now. That's a lot, and it's all public.

The force is encapsulation

Here's the new definition. A change is forced when its code uses a member no other class can reach: a private field, a private constant or a private method. That code can only live inside that class. Nothing about size or shape comes into it.

@RestController
class OwnerController {
    private final ClinicService clinicService;       // private: only this class can use it
    private static final int MAX_PETS = 5;            // a private constant forces too

    ResponseEntity<?> addPet(int ownerId, Pet pet) {
        Owner owner = clinicService.findOwnerById(ownerId);
        if (owner.getPets().size() >= MAX_PETS) {     // the new rule needs both
            return ResponseEntity.badRequest().build();
        }
        ...
    }
}

The new rule needs clinicService and MAX_PETS. Both are private to OwnerController, so the rule has to go there. The next rule that needs them has to go there too. That's gravity: the class keeps growing because it's the only place the data is.

Doesn't dependency injection fix this? Spring injects clinicService, so any other class could declare it. That's true, and the study counts it separately as the lever injection gives you. But the agent hardly ever pulls that lever. It's always easier to add to the class that already has the field. A choice that's never taken isn't much of a choice, so a private injected field counts as forcing too.

In OfficeFloor, the rule is a function that's handed what it needs:

public class CheckPetLimit {
    public void service(@Val Owner owner, PetLimits limits) throws TooManyPetsException {
        if (owner.getPets().size() >= limits.maxPets()) {
            throw new TooManyPetsException();
        }
    }
}

Nothing it uses is private to someone else, so nothing forces it into an existing class.

Essence and accident

The other change came from asking what coupling really is. Here's my view, and it's what the coupling prediction is built on.

The blocks of code are the essential complexity. They're the statements that actually solve the problem. Method calls are mostly accidental complexity: they exist to get those blocks run in the right order and to get data to them. A small program is one block with just enough method wrapping to call it. As it grows, the method structure grows around the blocks, and every call ties one block to another.

Function injection does away with much of that. Each function is handed its data, and the wiring says which function runs next. So I measure a program by its volume (the blocks of logic) and its surface (the links between them):

  • a method call weighs 1, plus 1 for each parameter, plus 1 if it returns a value;
  • a method using a field holding state, or a constant, weighs 1;
  • a wiring edge between two functions weighs 1, plus 1 if it carries a value.

Injection isn't surface in either framework. An injected value isn't passed along the control flow. A call made on an injected object still counts, though: injection saves you finding the object, not calling it.

What the study now predicts

The hypotheses are numbered in the order of the story, so the numbers have changed since the last post. Every main test compares OfficeFloor with Spring directly.

  • H1, the force. OfficeFloor's code is forced into an existing class less often than Spring's, and the gap widens as the system grows.
  • H2, a core draws code in. Later code keeps coming back for the few values earlier code was bound to, not for everything else lying in the class. And it comes back less in OfficeFloor.
  • H3, the encapsulation fills. Each class gathers more and more data that new code has to sit beside, needed or not.
  • H4, function injection forms no core. OfficeFloor's later changes don't keep returning to the same busy places.
  • H5, surface against volume. For the same amount of logic, OfficeFloor adds less link weight, and the gap widens over time.
  • H6 and H7, the literature's two ways of looking. Code shape (long, complex) and co-change counts are both predicted not to see the force. Shape follows where code was forced; it doesn't cause it.
  • H8, Run D. The same Spring stack with the agent told to make everything public. If encapsulation is the force, code should spread out.

H1, H2, H4 and H5 are the main tests, corrected together (Holm). H3, H6 and H7 are secondary. H8 is decided on its own run.

What the practice chain shows

This is one chain per framework, so it decides nothing. It's what I'd seen before writing the rules, and the plan records it:

  • The force: OfficeFloor was forced into a class 0.15 times per change, against Spring's 0.44, a ratio of 0.25 [0.09, 0.65]. Whether the gap widens can't be read from one chain.
  • The core: a value earlier code was bound to was come back to about a tenth as much in OfficeFloor, 0.09 [0.02, 0.32]. Later tangling where bound code was placed was 0.16 of Spring's at the class and 0.11 at the method.
  • The surface: no difference yet, and the trend goes the wrong way. For the same logic, OfficeFloor added about as much link weight as Spring, 1.05 [0.91, 1.21], and its share grew over the stream (1.70). The reason is visible. As the stream went on, the agent wrote OfficeFloor helper methods that call each other, rising from almost none to two calls per change. It drifted back into a method structure.

That last result is the one I'd most like to be different, so it's the one I'm most careful to report. If the real runs show the same drift, H5 fails, and the honest conclusion is narrower: function injection removes the accidental complexity only while the code is kept to it.

Things I took out, and why

  • "Choice narrows." H1 used to test whether the number of other places code could have gone shrinks over time. On the open-source histories, every placement was forced from the very first commit (638 of 638), so there was nothing to shrink from. Under the old rule, the strongest case of the force would have left H1 saying nothing. H1 now counts how often there's no choice at all, and the shrinking is reported alongside.
  • The cost to fix a concentration. I briefly had a ninth hypothesis: how many links you'd have to cut to split a class in two. But it only looked inside the class. The real cost of rewriting a handler is outside it: its callers, its tests, and the private members a split has to open up. So I deleted it.
  • Constants were left out of the surface in my first version. That was my choice, not a decision anyone made. A constant ties the code that uses it to the class that holds it, just as it forces code there, so it now counts. On the practice chain it moved the surface ratio from 1.06 to 1.05.

Guarding against myself

I created OfficeFloor, and I'd like it to come out well. So:

  • Every main test is OfficeFloor against Spring, on the same agent and the same change requests in the same order.
  • The weights were set so OfficeFloor can't win by construction. A wiring edge that carries a value weighs more, just as a call's parameters do.
  • Results that go against OfficeFloor are recorded, like the surface trend above, and the plan names exactly what would count against each hypothesis.
  • Nothing is read before the tag. Until plan-v1 is set, the scripts read only the practice chain. After it, any change is a dated, public amendment.

What's next

The plan is finished and so is the tooling. The tag waits on one thing: the ids of Run B, which swaps the front ends between the two backends so that a framework's effect can be told apart from its front end's. Then the tag goes up, and the real runs are read in order: OfficeHQ (the main test), petclinic as a replication, the open-source histories, and Run D last. The full plan is PLAN.md in placement-gravity-study. The results, including every place OfficeFloor does worse, will be in the next post.

Monday, 16 November 2026

The problem decides the size of the code, not its shape

For the last few months I've been measuring the shape of code to find god methods: how long a method is, how complex, whether it can be split. Each study found something. Each also ran into the same wall. I now think I had the question the wrong way round. Judging code by its shape, without knowing the problem it solves, is like marking an essay on its length without reading the question. This post explains the change, and why it closes three of my open experiments and merges what was useful in them into one new study.

What I was measuring

Three studies, each a step on from the last:

  • Complexity outliers. Flag the methods and classes whose complexity sticks out from the rest of their codebase (doi:10.5281/zenodo.23581333). It found where complexity piles up. It couldn't tell a god method from a genuinely complex algorithm.
  • Coupling divergence. Weight complexity by how much data a method hands on compared with what it receives. That didn't help. What reviewers actually call a Long Method turned out to be a length: 26 code lines (doi:10.5281/zenodo.23749773).
  • What extraction can't slim. Of the long methods, which ones can't be fixed by extracting methods, and can function injection take them apart (the study, doi:10.5281/zenodo.23991506).

Every one of these looks at code as it stands and asks whether its shape is bad. And every one kept bumping into something an earlier experiment had already shown.

The wall

In the degradation experiments, an AI agent grew the same application through the same 60 change requests, once in Spring and once in OfficeFloor. The result was Conserved amount, negotiable placement (doi:10.5281/zenodo.23190619): the total complexity came out about the same in both. The problem decided how much code there had to be. The framework only changed where it went.

Take that seriously and a problem appears. If the problem decides the amount, then a long, complex method is first of all a sign of a big, complex problem. A measure of how big or complex a method is measures the problem before it measures the code. Across a sample of unrelated projects, you're comparing answers to different questions. At best you find some consistency in the kinds of problems you happened to sample. At worst it's noise.

This gets worse with AI coding assistants. If developers hand assistants bigger and harder problems, what the code assistants write will be bigger and more tangled whether or not it's written well. Comparing its shape with code from before AI would tell you about the problems, not the assistants.

Size versus shape

So I've split two ideas I used to run together:

  • Size is set by the problem. A harder rule needs more code. No framework changes that.
  • Shape is how much room that code has to go where it likes: the space of places it could sit. That's what a framework can change.

The worrying thing isn't that code piles up in one place. Sometimes it should: things that change together are better kept together. That's the old point from Parnas, and it means concentration is neither good nor bad by itself. The worrying thing is code that piles up because it had no choice. A new rule needs a value that only exists inside an existing method, so it has to go inside that method. That method grows. Next time, more of what new code needs is in there, so even more gets pulled in. I've started calling this gravity.

Gravity can be measured, change by change, at the moment the code is written, with the problem held fixed. The next post describes how.

Closing three experiments, merging one

I had several experiments open, and most of them were about to read the same data: the backend Java of the new ui degradation runs, where an agent grows an application through 250 change requests on Spring and OfficeFloor backends. Each was going to measure a shape (junctions, unsplittable methods, sinews) on code where the problem only appears as a growing total. Three registrations would have had to guard against each other reading the same runs. So I've folded them into one study:

ExperimentWhat happens to it
Flow-injection containmentClosed, never registered. Its junction measure becomes one of the shape measures the new study tests. Its "same amount" check becomes the new study's.
SinewSlim analysis planWithdrawn by a dated amendment. It had been pushed to GitHub, which by its own rule registered it, so I couldn't just quietly drop it. Nothing of its runs had been read. Its go/no-go bar for OfficeFloorSlim stays in force, because that's a product decision fixed in advance.
Sinew identificationClosed. A sinew, data riding on the control flow, is what the new study measures as a tie.
Injected-coupling measurementShelved. It only existed to validate a measure for the flow-injection experiment.

Each repository now says so at the top, and keeps its draft as it stood.

Not throwing the old measures away

"Shape without the problem is noise" is a strong claim, and I'm the one who wants it to be true. So the new study doesn't assume it. It tests it. The shape measures from all the earlier studies go in as competitors:

  • is the method long?
  • can it be split?
  • does it hand on more data than it receives?
  • is its complexity an outlier?
  • how lopsided is its class?

The study asks whether any of them still predicts later tangling once the problem and the gravity are held fixed. If one does, then shape carries real information the problem doesn't, and I'll report that.

The study is placement-gravity-study, registered on GitHub (tag plan-v1) before any of the runs it analyses were read. The next post walks through it.

Thursday, 12 November 2026

Two weeks, two stacks, one flat battery: Run A so far

The sinews post described an experiment that had just started: whether an architecture that keeps data off the control flow keeps an AI agent from piling complexity into a few places. Its first run has now been going for a little over two weeks. This is a progress report, not a results post. It says how far the run has got, what went wrong along the way, and when it should finish. It deliberately says nothing about how either stack is doing.

The results of this experiment are meant to be read once, over complete runs, with the tests registered before the data. Looking at trajectories halfway through is how an experimenter starts nudging an experiment, even without meaning to. So this post only uses what the run's operation shows: which checkpoint each chain has reached, the logs of the waits and the restarts, and how long the queue of tests is. The correctness, cost and structure of the code are left alone until the end.

What is running

This is Run A of three: the two stacks as they were built, side by side. A later run crosses the front ends and back ends, and a third adds a control stack with no injection of any kind.

whatRun A
stacksAngular on Spring (dependency injection, halfway) and TanStack on OfficeFloor (function injection, additive)
change requests250 per chain, in five acts of fifty, every fourth one changing behaviour that already exists
chains10 per stack, one after another, each starting from the same almost empty application
agentClaude Opus 5.5, a fresh session for every request, shown only that request's own test
conditionjust-solve: the bare change request, with no structural guidance or grading
testseach request's own test after every checkpoint; the full suite of every test so far after every tenth checkpoint and the last
size of the job2,500 agent checkpoints and 2,510 test jobs per stack
started27 October 2026, just after midnight Perth time, both stacks within a second of each other

The plan was for two laptops, one per stack. In practice both stacks, each with its own test processor, run on one laptop. Each run has its own working directory, test queue and ports, so they do not interfere with each other. They do compete for the same CPU, and that matters for how long the testing takes, as described below.

Before it started: the stream's own bugs

Every expected value in every test comes from a reference model of the application, and three generated two-user scenarios sit beside each request's story. A thousand tests by the end means a thousand chances for the model, the test generator or a test helper to be wrong. So before Run A, the stream was calibrated on both stacks twice.

The rule for telling the stream's bugs from the agent's was simple. Two different agents building two different stacks will not make the same mistake at the same step of the same scenario. If both stacks fail a test in the same way, the stream is wrong.

  • First calibration (one chain per stack). From checkpoint 86 both stacks failed the same generated scenarios at the same steps. The causes were in the model: a date worked out in calendar days instead of business days, and identities kept as positions, which were reused after a merge or a transfer. Twenty-two requests were also reworded to say rules the model had been applying without stating them.
  • Second calibration (two chains per stack). About seventy tests failed in common or across chains. Each one was replayed through the model and read against its request. About fifty-five turned out to be the stream's, from eighteen causes, and each was fixed where it lived.

No rule was weakened to make a test pass. The second set of fixes was committed on 26 October, the night before Run A started, and nothing has been committed to the harness or the stream since. A fault found during a run is fixed after the run, for the next one. A running stream does not change.

Where it has got to

As of the evening of 12 November:

Angular / SpringTanStack / OfficeFloor
chains finished by the agent7 of 106 of 10
agent working onchain 8, request 14chain 7, request 114
checkpoints committed1,763 of 2,500 (71%)1,613 of 2,500 (65%)
tests running onchain 6, full suite at request 240chain 6, request 85
test jobs done1,494 of 2,510 (60%), 276 waiting1,339 of 2,510 (53%), 279 waiting

Every agent session so far has finished. None of the 3,376 has ended in failure, and none had to be cut short and gated on its partial work. No test job has errored either. A test job that fails some of its tests is still a job that ran, and those numbers are what this post leaves out.

The gap between the two stacks should not be read as a result. Wall-clock time on a shared laptop mixes the agent's own work with whatever else the machine was doing. The agents' cost, turns and time will be compared properly, over complete chains, at the end.

What happened along the way

The run is designed not to stop for anything a person can fix later. If the usage limit is hit, a token is rejected, the API fails or the network drops, the agent turn waits and tries again, indefinitely. The test queue is on disk, so a test job that dies is simply run again. Both of those were tested for real.

when (Perth time)what happenedeffect
27 Oct 00:03Both stacks start chain 1.
27 Oct 10:24 to 29 Oct afternoonUsage limit reached. Both stacks share one account, so both waited, retrying every half hour (107 times each).About 53 hours of waiting. That is why chain 1 took about 80 hours on both stacks, against 26 to 37 hours for every chain since.
4 Nov 01:58Weekly usage limit reached.Both agents waited again, 49 retries each. The test processors kept working through the backlog.
5 Nov 02:26The laptop's battery ran out.Everything stopped. Both agents were idle, waiting on the limit, so no agent work was cut off. Both test processors were partway through a full suite.
10 Nov 13:38Both runs resumed with the same run ids.Each chain continued from its last committed checkpoint. Each test processor found the job its predecessor had died in and ran it again from the beginning. Nothing was lost, apart from five and a half days.
10 Nov onwardRunning without a stop since the resume.The weekly limit had reset, so neither agent has had to wait again.

The resume was one command per stack, naming the same run and repository as before. It refuses a different repository, so a resumed run cannot quietly continue on the wrong stack. Its first lines in the log are a check worth showing. For every chain already finished it reports that checkpoints 1 to 250 are committed and leaves the branch alone. For the chain that was cut off, it names the checkpoint it is continuing from.

Smaller things the logs show, none of which needed anyone to step in:

  • One agent process crashed: its JavaScript runtime died with a segmentation fault partway through a turn. The harness treated it as a transient error, waited a minute, and ran the turn again.
  • One of the probes the harness runs to record what the agent touched timed out after fifteen minutes and was skipped. The checkpoint itself was not affected.
  • One agent found its usual port still in use by an earlier application, started its own test run on another port, and carried on.
  • One agent tried to write a log to /tmp, which its sandbox does not allow, and wrote it into its own task directory instead. The sandbox exists so the agent can never see a future test, and it held.

The long pole is testing, not the agent

The tests run beside the agent, not in its way. After every checkpoint the agent's commit is queued for testing and the next request starts straight away. A separate processor works through the queue in order, on a port of its own, with each job's tests fixed at the version of the harness it was queued under.

The plan budgeted about 45 minutes for the full suite at request 250, which is about a thousand tests. With two agents and two test processors sharing one laptop, it is closer to three hours. Full suites run every tenth request and grow with the application, so they take most of a chain's testing time. A whole chain has kept its test processor busy for 34 to 44 hours, while the agent finishes a chain in 26 to 37. So every chain the agent finishes adds to the backlog, which has grown since the resume to about 275 jobs per stack.

This affects only when the results arrive, not what they are. A chain's results are committed to its branch once its last test has run, and the order in which tests run cannot change their outcome.

When it should finish

These estimates use the rates of the chains finished since the first usage-limit stall, and assume no further stops:

agent finisheslast test finishes
Angular / Springabout Monday 16 Novemberabout Wednesday 18 November
TanStack / OfficeFloorabout Tuesday 17 Novemberabout Friday 20 November

Another usage-limit stall would push the agent dates back but barely move the test dates, because the test processors keep working while the agents wait. Another flat battery would push both back. Then the analysis runs over every checkpoint of every chain, and that will be the next post with numbers in it.

What this post leaves out, on purpose

Nothing here says whether either stack is passing its tests, what the agent is spending, or what is happening to the structure of the code. The runs record all of it at every checkpoint: the agent's whole session and diff, its cost and turns, every test's result, and every structure measure. All of it will be read together once both runs are complete, and compared chain against chain, ten a side. A run that is two-thirds done could be read as an early answer, and that is the reason not to read it yet.

Saturday, 7 November 2026

What extraction cannot slim: the result, and what it means for your long methods

I registered a study before looking at the data: of the long methods that Extract Method can't fix, how many can function injection take apart? I said at least a quarter. The answer is a bit over one in five. I was wrong, and this post is about what the 580 repositories showed instead, because what they showed turned out to be more useful than being right: a way to classify the methods no split reaches, and from that three studies to refine the tools down to the few methods that are a real concern, then to check whether the same measures hold on AI-written code. The full paper, with every number generated by script, is What extraction cannot slim, and whether function injection can.

The short version

  • Between a fifth and a quarter of long methods can't be fixed by Extract Method. Across 3 million methods in 580 Java projects, 5.6% of methods are long (26 code lines or more), and 22.8% of the long methods are stuck: no set of extractions gets the method under the cap without a return escaping a piece, a piece needing to hand back two values, or a piece needing more than five parameters.
  • Function injection takes apart a bit over one stuck method in five, not one in four. 22.2% of the stuck methods, interval 20.3% to 24.3%, so my hypothesis is refuted. Function injection is not a general fix for stuck methods.
  • Nearly half of the stuck methods are stuck only because of early returns. Guard clauses, a return inside an if. Extract Method can't take a piece that returns. A flow can, and the flow took apart three in four of those methods without inverting a single guard.
  • Where Extract Method works, a sequence of functions is a little cheaper about a third of the time, and only a little. The methods where functions win are pipelines: stages in order, each stage using what the stage before produced. The saving is one or two values per method. That saving is not a reason to adopt a framework. That saving is a reason to write the pipeline as functions if you're already in one.
  • The quarter of stuck methods that nothing splits is mostly not logic. A third of that quarter is tables and literals: giant switches of short cases, array initialisers, builder chains, argument lists. Most of the rest of that quarter is dense code where a jump lives inside a loop or a try, or where every cut would need too many values; a smaller part is a nested block too big to cut, such as an else-if chain or a try inside a try.

What was measured

580 open-source Java repositories, drawn at random by a separate tool with a seed fixed in advance, each repository pinned to the last commit before December 2020 so that none of the code was written with an AI assistant. OfficeFloorSlim, built on SinewSlim, scanned every production .java file and reported, for each long method, three things:

  • whether SinewSlim can slim the method by extraction alone, pricing each cut by what crosses the cut (how that pricing works);
  • whether the method comes apart as injected functions, where a return ends a function and a function can hand on several values;
  • the split a developer would actually make, called the combined split: functions where the flow divides, extracted methods inside the functions, priced by the sum of both.

The costs were fixed in those tools before the sample was drawn. The study computes no cost of its own, because I wrote the tools and the framework, and a cost I could tune would be worth nothing.

CountShare
Methods with a body3,026,902
Long (26 code lines or more)168,4665.6% of methods
Extract Method slims the method130,03377.2% of long
Stuck38,43322.8% of long

Those shares were the same whether a project had 200 stars or 50,000.

What the stuck methods are

Each stuck method was put in one bucket, testing the conventional fix first, so that function injection gets credit only for the methods nothing simpler fixes:

The stuck method…CountOf stuck
would slim by extraction if the method's early returns didn't exist17,12344.6%
slims by extraction if a record carries two values back3,7279.7%
only function injection takes the method apart8,52422.2%
nothing splits the method9,05923.6%

The 22.2% is the registered answer, and 22.2% is under the quarter I set. But look at the first row. "Would slim if the early returns didn't exist" is not a refactoring you can apply. To get rid of the early returns you invert the guards, thread a flag through nested ifs, or extract a piece that returns a flag the caller tests. Most developers would call the first two a worse design than the long method. The combined split handles the return as the return stands, and the combined split took apart 76% of those early-return methods without restructuring them. Of the stuck methods the conventional fixes can't reach at all, the combined split takes apart about half. That is the clearest thing in the data: single-exit extraction can't deal with an early return, and a flow can.

Where Extract Method already works

130,033 long methods can be slimmed by Extract Method alone. For each of those, the combined split was free to choose: keep the method as a method and extract pieces from the method, or cut the method into injected functions with extracted pieces inside the functions. The combined split chose functions, and the functions cost less than extraction, for 29% of those methods. Measured against plain extraction with no framework wrapper at all, the functions cost less for 17%. The median saving was 2. So the gain from functions is real, small, and specific to one shape of method.

The shape is a pipeline: 96% of the methods where functions cost less are straight sequences, stage after stage with no branching, each stage using what the stage before produced. Here is why a pipeline is cheaper as functions and other shapes are not. Extract Method prices a value twice when the value crosses a cut: once on the way out of the piece that produced the value, as a return, and once on the way into the piece that reads the value, as a parameter. Extract Method also prices the method's own parameters into every extracted piece that reads them. A flow between functions prices a value once, in the function that declares the value as a parameter, and a flow never prices the method's own parameters, because the framework injects them into whichever function needs them. The consequence: a boundary that one computed value crosses costs the same under both. Where two or three values cross one boundary together, or where a method parameter such as options is read in every stage, the flow is cheaper than the extraction. Where a boundary carries nothing at all, the flow still costs 1 and the extraction costs 0, so the extraction is cheaper. That is the whole mechanism, and the paper works two short examples through the formulas term by term.

The stuck methods that only injection takes apart have the opposite shape: 64% of those methods branch, an if or switch whose arms each do real work, usually with an exit inside an arm. A branch with an exit inside is exactly where a single-exit extracted piece fails, and exactly where a decision function with a flow per arm does not.

The quarter that nothing splits

9,059 stuck methods have no plan from either side. After the registered results were in, I re-read all 9,059 methods from source to see what the methods are. This re-reading wasn't registered; the re-reading is there to decide what the tools should do with the methods they stop at, which is the programme at the end of this post.

  • A third of the 9,059 are tables and literals (3,030 methods): switches of short cases, flat lookup switches, array initialisers, long argument lists, builder chains, string concatenations, constructors that only call super(…). The cognitive complexity of these methods is about zero. These methods are long because they hold data or options, not logic. If your linter flags one of these methods, the linter is flagging a table, and arguably the linter shouldn't.
  • Most of the rest of the 9,059 is dense. In 91% of the methods blocked by a jump, the jump is inside a loop, a try or a switch, and a step that breaks out of the loop enclosing that step can't become a function. Where an if blocks the split, the obstacle is the values the branches pass on, not the branching. And raising the five-value limit helps less than you'd think: a limit of six rescues 4.4% of the 9,059, a limit of ten rescues 12.5%, and a third of the data-coupled methods have no plan even at ten.
  • Shape, not complexity, keeps a method on this list. At the same length, the 9,059 methods are no more complex than the methods injection rescues.
  • The list clusters. 32 projects hold 40% of the 9,059 from 22% of the long methods. The tables cluster hardest, which looks like generated code or a house style of building data in code. The dense logic is spread evenly across projects, which looks like how people write.

What this means for the method you're looking at

The method looks likeWhat 580 projects say
Stages in order, each stage using what the last stage produced, no early exitsExtract Method works. Written as a sequence of functions the method is cheaper by a value or two. Write the sequence if you're already in a framework that sequences functions. Don't adopt a framework for that saving.
Guard clauses and early returns you don't want to invertThis shape is where extraction is stuck and a flow isn't. Three in four of these methods came apart as the methods stand. If the choice is inverting your guards or letting a framework end a function at the return, this is the case for the framework.
An if or switch whose arms each do a lot, with exits inside the armsA decision function with a flow per arm takes the method apart where a single-exit piece can't.
A giant switch of short cases, an array literal, a builder chainThe method is a table. Nothing splits a table and nothing should. Leave the table, or move the data out of code.
A long loop body with a break or return in the body, a try with resourcesNothing splits this method today, by extraction or by injection. Redesign the method, or leave the method and say why.

The one line to take away: function injection takes apart a bit over one stuck method in five, and nearly all of the methods function injection wins are early returns and pipelines. If your long methods are neither, function injection has nothing for you. What the study has for you instead is the table above: a long method is now one of a handful of shapes, each with a known fix or a known reason there isn't one, and the programme below is about making the tools say which.

Where injection did worse, and what to be careful about

Every failure is published. Where both extraction and the injection split have a plan, the injection split's worst seam carries more values than extraction's widest piece for 4.5% of methods, 4,993 of them, each method listed. The injection split also cuts more: more functions than extraction makes pieces for two thirds of methods. And the seam comparison leans towards injection by definition, since a function's seam doesn't count the method's parameters and a piece's width does.

"Stuck" means stuck under SinewSlim's rules: one exit, one return value, at most five parameters a piece. An IDE can extract a run with an early return by returning a flag the caller tests; SinewSlim doesn't search that form of extraction. Nobody wrote any of this code for function injection, so a plan is what the split would cost, not what anyone paid. And I created OfficeFloor and both tools, and have a commercial interest in OfficeFloor's adoption, which is why the sample was drawn by someone else's seed, the costs were fixed at or before registration, and the hypothesis was written down where the data could refute the hypothesis. The data did.

What's next

Three follow up studies to consider, each one a change to the tools, each one narrowing what the next has to explain, each registered the way this study was: a dated commit of the plan and the seed in a public repository before the sample is drawn, with scripts anyone can rerun. I'm a tool and framework developer trying to understand how software behaves, not an academic. The repository is the registration.

  1. The classes become rules in the tool. The re-reading of the 9,059 methods used explicit thresholds: a switch whose cases are all three lines or fewer is a flat table, a chain of four or more calls is a builder, eight or more arguments is a long argument list, a jump is placed by the loop or try that contains the jump, and a data-coupled method is marked by the first limit at which a plan appears. Those rules go into SinewSlim, so a method the split can't plan gets a class and the advice that fits the class: leave this table where it is or move the data to configuration, extract this case, extract this loop body with the jump as a status result, group what this stage produces. Two tests: a fresh sample drawn the same way gives the same class shares, within this study's intervals; and reviewers agree with the class and the advice, class by class, with the tables first, because if reviewers don't call a table a long method, the trigger changes.
  2. Each class gets the change that reaches the class, and what's left is the definition of a god method. A jump inside a loop, try or switch (1,128 methods): the splitter learns named outcomes, so the break, continue or return becomes a named exit of the function, wired in configuration. An if whose arms pass values on (267 methods): the arms become functions with the value as the flow's argument. Data coupling (3,237 methods): the limit of five is swept from three to ten over the whole population, because a higher limit moves the other categories too. Each change is tested on the methods already listed and read by two numbers: how many of the class now split, and whether what came out got denser, since a split that slims by growing denser hasn't helped. What remains when every class has had the change that reaches the class is a method over the cap that no split and no rule-following rewrite takes apart. That's a definition of a god method with no human judgement in it, and the hypothesis is that the remainder is under one long method in a hundred, dense logic, and the one place the notice should say "redesign".
  3. The same measures on AI-written code. Everything here predates assistants. The third study draws the same kind of sample from code written after assistants were in general use and compares the long share, the stuck share, the class mix and the remainder against the figures here, which are the baseline. What the measures don't say, and I'll keep saying so: nothing about how methods couple to each other or whether the code changes well. They confirm decomposition, and only that.

Run it yourself

Everything is a script in long-method-slim-study, and every number in the paper is generated from the committed analysis.

If you find a method where the split does worse that isn't in the list, or a reason the split fails that isn't in the table, I want to hear about it.