Wiring
Page 6 of 8 · Per language

Each template gets one piece we own

A source generator in .NET, a preload plug-in in Bun, a go generate step in Go and a build_runner builder in Flutter.

One pattern

Every language uses the same three parts: a marker, a finder and a written list

The idea is the same in all four templates. Each feature carries a small marker that says "I am a module". A tool finds every marked feature and writes the list that start-up needs. The difference between languages is only when that tool runs.

  • In .NET and Bun the tool runs by itself, inside the compiler or before the code loads, so there is nothing to remember.
  • In Go and Flutter the developer runs a command, so the tool's output can be stale until they do.
  • That is why .NET and Bun are the cheapest, and Go and Flutter need a CI check for a stale list.
.NET

.NET: a source generator, and nothing to remember

The .NET row was measured on alcohol.zinc in this test Measured:

.NET
Piece we shipStep to rememberKnown cost
Gen/ source generator, 251 linesnone: it runs in every buildwe own and maintain it
[ServiceModule] marker and a registration file per modulenoneone more hop in go to definition
partial class MainDbContext and a tables file per modulenonetwo namespaces in one file
CI line has-pending-model-changesnoneabout 5 s after the build
Guide line for snapshot conflictsone command, only on a clasha new migration id for the second author

The CI line took 4.5 s here. The real cost is owning 251 lines of generator code.

Bun

Bun: a preload plug-in, and a build script for releases

Bun was measured in an earlier test Measured:

Bun
Piece we shipStep to rememberKnown cost
tools/features-plugin.ts, about 100 linesnone for run, test and watchthe list's stack-trace frame is not a file
bunfig.toml: preload and [test] preloadnone4 lines
tools/build.ts, 20 linesrelease build uses it, not bun buildthe command line cannot load plug-ins
knip config linenoneone line, once

The build script is the only visible cost. A developer who types bun build by habit gets the error Could not resolve: "virtual:features" instead of a build. Decide thisQ4Is the Bun release-build script acceptable?

Go

Go: a go generate step that a developer must run

Go was measured in an earlier test Measured:

Go
Piece we shipStep to rememberKnown cost
//di:module marker per modulenoneone comment line per module
generator for go generaterun go generate after adding a moduleif forgotten, the dev server misses the module silently
committed wire_gen.gononetwo pull requests both touch it
CI freshness checknonea conflict is fixed by re-running generate

In Go the generated file is committed, so it is the one shared file each feature touches. A forgotten go generate is the main risk: the dev server then runs without the new module and says nothing, so CI checks that the file is fresh.

Flutter

Flutter: a build_runner builder, and one command on a fresh clone

Flutter was measured in an earlier test Measured:

Flutter
Piece we shipStep to rememberKnown cost
build_runner builderrun build_runner on a fresh cloneabout 1 minute cold
@Service and @AppRoute markersnoneone line per class
dev watchkeep build_runner watch openpress R (restart) to see a new feature
clean buildsdelete generated files after flutter cleanAsset already exists until then

Flutter asks the most of a developer: one command on a fresh clone, and a watch process during work.