Code That Humans Can Still Read

Writing code has become almost effortless. What hasn’t become effortless is understanding what the code does, and I think that is about to become the most important skill in software.

The reason is liability. When a company commits tax fraud, or a system turns out to be unsafe, or money disappears from the books, someone answers for it. That someone is always a person, because a machine can’t be held liable for anything. So the people who matter most are the ones with skin in the game: the CFO who signs the accounts, the operations manager who owns the warehouse, the founder who answers to the auditors. More and more, those people are relying on software that neither they nor anyone around them has actually read.

In the last few days Anthropic and OpenAI have shown models producing proofs in Lean, and the results are stunning. I was stunned too. But when I read the discussions afterwards, I noticed that most people, including me, couldn’t really say what had been proven. We knew the proof checker had accepted it, and that was all.

For a theorem that may be enough. For the system that computes your VAT or your payroll it isn’t. Either we keep software interpretable by the humans who answer for it, or we accept that we no longer control what AI builds for us. And I don’t think software we can’t control serves us in any real sense. Things just happen to us through it.

A thought experiment

This made me wonder what it would take to replace the old, bloated legacy systems that run most companies with a single elegant programming language.

It would have to be readable by a manager, which means it would have to talk about customers, orders, invoices and money rather than controllers and migrations. But it would also have to be a real language, with a grammar and a compiler. Rules written in plain English get interpreted differently by everyone who reads them, and a compiler is the simplest way I know to force everyone to agree on exactly what was meant.

That’s why I built Quadra. Here is a piece of a Quadra model, taken from the minimal example in the repository:

entity Customer:
    name: Text unique
    credit_limit: Money<EUR> default 1_000.00 EUR
    orders: [Order]

    open_total = orders.where(o => o.state is Confirmed).sum(o => o.total)
    check open_total <= credit_limit, "Credit limit exceeded"


entity Order:
    customer: Customer
    lines: [OrderLine]
    state: enum(Draft, Confirmed, Shipped, Cancelled) default Draft

    total: Money<EUR> = lines.sum(l => l.amount)

    frozen when state is not Draft

    flow state:
        Draft -> Confirmed              by confirm
        Confirmed -> Shipped            by ship
        Draft | Confirmed -> Cancelled  by cancel

    action confirm:
        require lines.count() > 0, "Order has no lines"

    post to Stock when state is Shipped:
        for l in lines:
            add(product=l.product, qty=-l.qty)

I’ve shown code like this to people who have never programmed, and they can follow it. A customer has a credit limit. Confirmed orders count against it. Once an order leaves the draft state it can’t be edited. When it ships, the stock goes down.

Quadra’s engine runs this model directly: it executes the rules and the actions, keeps the history, and from the same model it builds the database, the API and the interface. Because the model is declared rather than buried in procedural code, the compiler can check things a general-purpose compiler never could: formula cycles, states that can’t be reached, amounts in euros added to amounts in dollars, money that was never rounded. You can also ask it what a value depends on, and it will tell you who writes it and who reads it.

A confession

Almost all of Quadra’s code was written by AI. I decided the design, the principles, and above all what to leave out, but the machinery itself was mostly generated.

I don’t think that should worry you more than any other new project. If an LLM can prove theorems that the best mathematicians couldn’t, it can certainly write a type checker. What it can’t do is decide what the language should mean, or take responsibility when an invoice comes out wrong. Quadra is built around that division of labor: the machinery can be generated, as long as the business logic stays in a form that the people accountable for it can read.

Previous attempts

The idea of a language for business software that managers can read is old, and I’m not the first to try it. It’s worth looking at why the earlier attempts didn’t get there.

The first and most famous is COBOL, designed in 1959 with an English-like syntax precisely so that people outside programming could read it. In one sense it was a huge success: it handled money with exact decimals, and a lot of the world’s banking still runs on it. But the English was only on the surface. Underneath, COBOL was procedural, so the business rules ended up spread across thousands of paragraphs that call each other, and reading ADD AMOUNT TO TOTAL in English words didn’t help anyone understand what the system as a whole was doing. COBOL programs became the bloated legacy systems I want to replace.

In the 1980s and 1990s came the fourth-generation languages: dBase and Clipper, FoxPro, Progress 4GL, PowerBuilder, Informix 4GL. They were genuinely productive for building business applications, and a generation of small companies ran on them. Their problem was that each one was tied to a vendor and to a platform. When the world moved to client-server and then to the web, most of them were left behind, and the applications written in them were left behind too.

ERP vendors went a different way and built languages into their products: ABAP for SAP, X++ and C/AL for Microsoft Dynamics. These are serious languages that run serious businesses, but they exist to customize one product. The model of your company lives inside the vendor’s system, and you can’t take it with you.

There were also more radical attempts. LogicBlox built business applications on Datalog, a declarative logic language, which is about as precise as you can get. It was powerful, but the code was readable mainly by specialists, and the company ended up acquired by an ERP vendor.

What strikes me, looking at them together, is that each one solved part of the problem and gave up another part to do it. Readability came at the cost of structure in COBOL, and precision came at the cost of readability in Datalog, while the 4GLs and the ERP languages traded your independence for their productivity. Quadra tries to keep all of it together: a declarative model, readable by the business, checked by a compiler, open source, and not tied to any vendor or platform. It may well fail like the others, but as far as I know nobody has tried that particular combination.

Why no-code fails

No-code and low-code tools feel wonderful on the first day. The trouble starts around the three-hundredth.

The logic in those tools lives in dialogs, checkboxes and drag-and-drop blocks, spread across dozens of screens. You can’t search it or diff it, and you can’t review a change to it the way you’d review a pull request. When you want to know who changed the discount rule last March and why, there is usually no good answer.

Then a real edge case shows up, because in business software it always does. A partial refund, an invoice in two currencies, an approval that needs an exception. The platform can’t express it, so someone writes a script in a corner of the platform where it’s invisible to everyone else. After a few years, the important logic lives in those corners. And the whole model belongs to the vendor anyway, so leaving means starting over.

Why AI-coded apps fail

The newer approach is to have an AI generate a custom back office in an afternoon, using a popular framework and a popular language. This works much better than no-code at first. The problem is that the framework and the language are generic.

A generic language doesn’t know what money is. Prices end up as floating point numbers, rounding happens wherever it happens to happen, and currencies are strings. The resulting bug sits somewhere in a file of several thousand lines, and it surfaces months later as a few cents that don’t reconcile.

A generic framework also gives the business rules no natural home. Part of the order logic ends up in the ORM, part in a controller, part in a React component and part in a nightly job, so there is no single place you can point to and say “this is how an order works.” And the boring parts get reinvented each time. Authentication, roles, retries, audit logs and migrations are generated fresh for every app, each with its own subtle holes.

Worst of all, the person accountable for the numbers has no way to check them. They are handed forty thousand lines of TypeScript that seem to work, and have to take them on trust.

What Quadra does differently

The central idea is that the model is the source of truth. Data, rules, processes, permissions and metrics all live in one place, as plain text in a git repository, where they can be reviewed like code and read by the business.

Everything else follows from keeping that model fully visible to the compiler. Queries are written in the language itself rather than as SQL strings, and there are deliberately no macros or other escape hatches, because every part the compiler can’t see is a part where its guarantees stop. That visibility is what lets it catch the mistakes I described above before they ship.

The engine is deterministic. Given the same data and the same code it produces the same result, even when replaying a year of history, which is why formulas aren’t allowed to read the clock, the network or an AI model. History is stored as a hash chain, so every number can explain where it came from and who changed it. Metrics can be certified, meaning their definition is fingerprinted and approved, so “revenue” can’t quietly change meaning between two quarters.

Money is exact. Quadra uses decimals rather than floating point, currencies and units are part of the type, and rounding is always explicit. And transactions are all or nothing. If a rule fails, the whole transaction rolls back, and since there is deliberately no try/catch, an error can’t be swallowed in a way that leaves the books half updated.

The practical consequence is that for your next back-office app, there’s a list of things you no longer have to think about:

  • authentication, roles and permissions
  • queues and delivery retries
  • edge cases and side effects
  • history tracking and audit logs
  • RPO, since committed batches can be written to a log on a separate disk before the commit is confirmed
  • the frontend, which Quadra Studio gives you out of the box, though you can also build your own on the API

Quadra is open source under Apache 2.0. It runs on SQLite or PostgreSQL, and it behaves the same on your laptop, on a plain server, or on Quadra Cloud.

Is it ready?

No. I don’t think a system built mostly by AI, even one built on sound principles, deserves trust before it has earned it, and the only way to earn it is experience. Experience in this case means getting slapped in the face several times, fixing what broke, and slowly making the system more reliable. Quadra hasn’t been slapped enough yet.

But if you have a small internal app, the kind that currently lives in a spreadsheet or an old Access database, I’d encourage you to try it:

curl -fsSL https://quadra.run/install.sh | sh
mkdir shop && cd shop
quadra init
quadra dev

Please consider all of this an experiment. The documentation and an in-browser sandbox are at quadra.run, and I’d be grateful for feedback, especially the harsh kind.

← All posts