Skip to content
Software Natives

§ Why coding · Part 2 of 3

How why coding works

Why coding, part 2 of 3. Part 1 asked who stays in control when agents write the code, and gave the first part of the answer: whoever owns the whys and their ranking. This part shows how the work should run.

So who stays in control? You do. Not of the code: you leave that to the agents, except where a standard, a regulator or a contract says otherwise. You stay in control of what gets built: you own the whys and their ranking, you confirm the whats that matter to you, and you check them by behaviour, not by reading code. Where someone has a why about the code itself, such as a developer who must maintain it, that becomes a what like any other.

Not all of it has run yet. A customer project is about 80% through, built by agents I set up quickly on parts of this method. For my own tool, I have run the why sessions, settled the 26 conflicts below and built a first version. Still open: tests the coding agent cannot change (locked tests, below), running the whole chain end to end, and agents finding the environment on their own. I mark those places as I go.

Two inputs: your whys and the environment

An agent needs more than your whys. It needs to know where the software will live: the operating system, the tools, the company rules, the regulations, the hardware, and the people who will work with it. That is the environment, and each part of it that affects your software is a constraint.

One observation simplified everything for me. Most constraints are other people’s whats, and behind each one stands their why. A company rule that every large purchase needs a second signature is the finance department’s what; their why is to catch costly mistakes. Data protection law is the lawmakers’ what; behind it stands the why of the people whose data it is: they want to keep control over it. Only two things are different, and nobody’s why stands behind them: the laws of nature, and plain facts of your situation. A moving machine part keeps its momentum whatever anyone wants, and your garage is as big as it is.

Others' whys and nature fill the rest of the circle. The part 1 figure, plus two whys of others at the bottom that add whats of their own and share one with your whys, and nature as the ground under everything, shaping a what and the how without being anyone's why.
Others' whys add whats or rule some out. Nature is nobody's why; it only shapes what the whys ask for.

Not everything in the environment is equally hard to change. Some of it was set by someone still around, and one conversation may change it. Some of it was fixed into the world long ago and changes only at a cost. The laws of nature do not change at all. In the moment, all three feel fixed. But an agent that knows the why behind a constraint could tell you when a cheap change would unlock a much better design, instead of quietly designing around it.

I have not tried this yet, but I expect agents to discover much of the environment themselves, if they measure instead of assuming; you would then confirm what they found and fill the gaps. Only you can say what you want, and which of your wants matters most.

What can go wrong

Cables get cut, power drops, sensors break. These are faults. A fault together with the danger it creates, such as a machine axis that does not stop, is what ISO 12100 calls a hazardous event. I say hazard for short, although in that standard the word means the source of harm itself: the moving axis. Faults and hazards both belong to the environment: they describe what can happen. Once a hazard is found, it combines with a why into a what (to use the usual term, a requirement). “The cable can be cut and the axis then keeps moving” plus “the axis must not crash” gives “when the cable is cut, the axis stops before its end stop”.

Hazards must be found systematically and up front, not by watching results. In machine building, the risk assessment is a required document, and the manufacturer stays responsible for it. Much of what goes into it follows from common knowledge, standards and regulations, such as ISO 12100 for machine risk assessment, the EU Machinery Regulation or the Cyber Resilience Act. I expect agents to draft a good first version from those; people sign it off.

You do not have to state everything

When you buy a car, you might say you need seven seats and lots of luggage space. You do not say how the engine should be built. You never say that the brakes must work either: that comes from the environment, here from industry standards. What you do not care about stays free for the builder, and fewer whys also mean less to review.

How much you leave open is your choice, project by project. What you leave open, the agents decide, and they write their decisions down for you to check if you want to. The more of the environment they know, the more complete the whats they can add on their own.

Some things you care about, you are not aware of up front. You only notice them when you see the result. You walk into the car dealer with a few requirements in mind: seven seats and lots of luggage space. Two cars meet both, a small one and a big one. Only when you see the big one do you realise there is another requirement: it must fit into your garage. So you measure the car and your garage. From then on, “it must fit into my garage” is on your list, for every car you look at. Your list just got better. That is the safety net. Builders and agents catch what they can. Then you look at the result in its environment, like the car next to your garage, ideally before anything real gets built: a quick mockup or a simulation often makes problems stand out at once. Notice what is missing, write it down as a why or a piece of environment, and build again.

When whys collide

When two whats conflict, it’s tempting to rank them against each other. Don’t. Ask why once more behind each side instead. Often the conflict then dissolves, or the whats just need new wording. If the finer whys really collide, you rank those.

Part 1 named two bad ways when no ranking decides: ask at every conflict, or guess. Here is a third: if it can’t be decided at build time, it becomes a new what, and the software lets you choose at runtime. A car shows it simply: some days you want a relaxed drive, some days a sporty one. The car maker can’t know which at build time, so the car gets a switch for you to choose.

My own case was similar. Besides a project for a customer, I’m building a tool that supports me in my work. I want to talk to it instead of typing, and the best speech recognition usually runs in the cloud. But my private thoughts should stay with me. So two whys collide: talking without effort, and keeping my private thoughts with me. Which one wins depends on the day, and even more on the topic: a technical question can go to the cloud, a psychological one perhaps not. Just like the drive, it can’t be decided at build time, so it became a new what: each session, the tool must show me where my words will go, and let me confirm or change it, instead of the agents deciding for me when they build it.

For that tool, 26 conflicts came up. Not one needed a ranking of whats, and only five needed a ranking of whys; the rest dissolved through a finer why, a choice at runtime or a bar (a level that counts as good enough), or turned out to be no conflict at all. The ranking stays yours, as part 1 said; you just need it less often than you might think. Where you do need it, it steers what gets built (more in part 3).

Some whats matter more than others, and the whys behind them tell you which. Behind the seven seats is a why: take the whole family along. Behind the luggage space is another: bring along what the family needs for the trip. With all seven seats in use, the third row takes most of the boot, and a bigger car won’t fit your garage. Before you pick one, look for an answer that serves both. If you only state that why, a good builder may suggest a roof box. That works as long as the car with the box still fits into your garage, and you confirm it before it gets built. In spec-driven development, the spec would say “a boot of at least 500 litres”, and the agent would build exactly that. That is one of the biggest gains of why coding: a what hands the agent your solution, a why puts the agent’s own intelligence to work on finding a better one.

Only if nothing serves both do the two whys really collide, and you rank the family above the bags. That ranking makes seven seats a must and luggage space a best effort: as much as the seven seats and the garage leave.

The ranking decides the kind: only a what in conflict needs it. The car is the how. Two of your whys outside: take my family along, ranked first, and take our bags along, ranked second. Their whats sit on the ring: seven seats, a must, and luggage space, a best effort, because with all seven seats in use the third row takes most of the boot, and the family ranks higher. A fact at the edge, the garage, sets a fourth what, fits into the garage, a must, without being anyone's why. A third what, the brakes always work, comes from an industry standard, a binding rule from outside: a must that is not yours to rank.
First ask whether one answer serves both whys, such as a roof box that still fits the garage; only if none does, the ranking decides. With all seven seats in use, the third row takes most of the boot, and a bigger car won't fit the garage. Taking the family along ranks higher, so luggage space can only be a best effort. The garage is a fact, so fitting into it is a must. The brakes come from an industry standard, a binding rule from outside, so they are a must that is not yours to rank. Most whats need no ranking at all.

How the work should run

Once your whys and the environment are written down, the whats follow from the two combined. Only when no conflict is left open do the agents build the how. This is how I intend the loop to run; I have not yet run all of it end to end:

  1. An agent combines your whys with the constraints of the environment, that is, the rules that come from other people’s whys and the facts of nature, into whats. Before any test is written, an agent looks for conflicts that are still open: first in the links between whys and whats, then by a fresh agent reading for meaning. A third pass asks of each what whether the check it will get could ever fail: a check that can’t fail proves nothing. Each finding comes to you with a suggested answer. The goal is that no agent later hits a conflict it would have to guess about.
  2. A test agent gives each what a check. Usually that is a locked test: a black-box test at the system’s boundary, written before the code it checks and kept where the coding agent cannot change it. Some whats need a different check, such as a measurement, an attack or someone’s judgement. The details vary; the rule does not: every what gets its check before any code exists.
  3. You approve the checks from a plain-language list of what each one checks, traced through its what back to a why.
  4. A coding agent writes the code. It gets the whats, each marked must or best effort, but not the whys; how it builds is up to it, as long as the checks pass and no what says otherwise. The whys go to the agents that derive the whats and judge the result.
  5. You watch the whole system behave wherever it meets the outside world: people, other systems, the hardware it runs on or controls.

I’m assuming that coding agents don’t need the whys, and that’s how I built the first version of my tool: they saw only their tasks. My mistake: I didn’t tell them which whats were musts and which were only best efforts. So they spent time on things that mattered little. I fixed that, and now every what is marked as a must or a best effort. I’m watching whether that’s enough.

When something looks wrong, first ask whether a why or a piece of environment is missing. If one is, add it. A new why can change existing whats, because it may outrank the whys behind them; a new piece of environment can add whats or rule some out. So your whats and their locked tests change only when your whys or the environment change, or when a what needs sharper wording; never to fit the code. A test that looks wrong goes back as a question about its what. How the code changes is up to the agents.

So what happens to code review? As many developers know, code review finds fewer defects than one might hope; much of its value lies in spreading knowledge and keeping a team aware of changes (Bacchelli and Bird, 2013). Agents do not learn from a review the way colleagues do: they forget between sessions, so every lesson has to be written down where the next agent will find it: in a why, a what, the environment or a locked test, at whatever level you want to keep control. These inputs are what you mainly review now, not the code. Look at the code only where you care how something is built. Even that care can often become a what: if readable code matters to you, set a limit on cyclomatic or cognitive complexity as a rough proxy, and review the numbers instead of the code. Everywhere else, you check the behaviour at the boundary against your whats and the constraints of the environment: a visible record of which whats were checked, and behaviour you can see. For safety-related software, standards such as IEC 61508 and ISO 13849 require review and verification, and set rules for how the code is written and for the tools that write it, an agent included. In such projects, I expect those rules to simply become whats, so why coding adds evidence and removes none. I have not tried that yet.

Not vibe coding

In vibe coding, a term Andrej Karpathy coined, you accept changes without reading them. People who vibe code usually know why they are building something, but the why stays in their head. They judge the result by feel, so they have nothing to check against. Why coding mostly skips reading the code too; the difference is that you have something to check against.

In why coding, you write the why down, derive the whats from it, and test against those whats, because they are precise enough to test. If you can’t say how you would check a what, by a test, a measurement, an attack or your own judgement, it is usually still a why, and you derive checkable whats from it; or it is a what that just needs sharper wording. You aim to find the whats that matter to you; what you miss, you catch by looking at the result. That matters more with agents than with people: colleagues share years of context, so a vague why is often enough. Agents act only on the whys that are written down.

The whole chain, on my own tool

Back to the tool that supports me in my work. Here is how the whole chain is meant to run for the two whys behind its voice feature.

  • Why: my private thoughts stay with me, and I can still talk without effort.
  • Environment: the best speech recognition usually runs in the cloud.
  • What: each session, the tool shows me the default, cloud or local, and I confirm or change it; in local mode, nothing I say leaves the device.
  • Faults: local speech recognition fails, or an update resets the setting. The danger: my words leave the device without my consent.
  • Checks: locked tests for both faults, and an attack that tries to make it send anyway.
  • How: left to the coding agent.
  • What you look at: a network monitor that stays at zero while I talk in local mode.

This shows how the chain is meant to work.

What it means for developers

If agents write more of the code, the work does not disappear; it moves. Developers can become builders who turn their clients’ whys into systems that hold up, who know why each part is there, and who can show it.

Next week, in part 3: what I have tested so far, the older ideas this builds on, and where it might break.