I still don’t read the code

Read first: It’s the abstraction, stupid

I have a good friend who is building a startup. Just as I’m doing with Paperhat, it is just him and his agents.

Where we differ is in what we do ourselves. I have an orchestrator, an implementer (which often spins off parallel agents), and one or more hostile auditors.

I conduct this orchestra. I don’t play any of the parts. So as it is, I neither write the code nor read it. Any of it.

What I care about is what the audience hears. I presume that the first violinist knows his instrument better than I ever will, and that the trombonist will keep her place in her sheet music.

My friend is a programmer. I used to be one, but I always dreamed of being an architect.

Funny aside: as a young child, my hero was Frank Lloyd Wright, who studied civil engineering at Wisconsin. I went to Cornell initially to become a civil engineer, architect on the horizon.

My friend still writes some code. More interestingly, he reads the code. All of it.

He wants to review what the agents write and be able to make changes himself.

He wants a say in everything from domain definitions and abstractions right down to file and folder structure.

And I get it. When I write code, I’m every bit as picky as he is.

His reason is one of control. And security. Not just that the code is secure, but that his company is secure. He’s responsible for what his company ships, and reading the code is part of how he exercises that responsibility.

It’s about the business, and when it comes to business, he is so far beyond me that I can’t even see his taillights.

On a scale of one to ten in business acumen, I was a negative three last time I looked.

So far be it from me to tell him that he’s doing it wrong. Maybe he is doing it right and I’m the one heading for the cliff.

I’m pretty sure that I’m not, but that confidence has been misplaced before.

He’s invited me to help him out, so I am going to do so. And I’ll do it his way. It’s his project, and he decides how the work gets reviewed. Hey, I might learn something I can bring back to my own. And he gets help. Win-win.

It’s about the archaeology

But there is a reason that I don’t use his approach on my own projects. It’s archaeological.

Reading the code is like digging for relics at an archaeological site. You dig one up, and then you ask, “What could this be? How was it used? And why this design?”

You may think I’m talking about digging through legacy code, but if the AI wrote the code, it might as well have been legacy.

It could have written it five minutes ago. I still have to figure out what it does and why it does it that way. I’ve had to do the same thing with code I wrote myself.

And somebody pays for that time. If the agent took five minutes to write a patch and I took an hour to work out what it does, that hour goes on the bill, too. How long would it have taken me to write and check the patch myself?

What matters ⁠— to my mind ⁠— is does the code do what it is supposed to do?

That’s it. That’s the whole thing. That’s all that matters. To me.

And we all already know this approach, don’t we? What, after all, is encapsulation?

Why do we create formal APIs and then treat modules as black boxes? Isn’t the entire point of decoupling code and publishing an interface so that we don’t have to care how it does it?

Divide by zero

Let’s take a simple example. Suppose I want the AI to write a function that takes two integers, divides the former into the latter, and returns a quotient and a remainder. You know: proper integer division.

Do I care whether it uses the built-in functions, loops through subtracting the divisor from the dividend until only the remainder, um, remains? Or uses recursion?

I do not. Oh, but the performance, you say! Yes, but that’s just another test. If it takes ten seconds to do a simple (but large) bit of division, then I’m going to have another, smarter agent take a look at the code.

I can even have several agents try to speed it up. I run their versions on the same inputs and see which is quickest while still passing all the other tests.

My debugging happens at the same level of abstraction as my architecture. I can tell an agent which answer was wrong or which input took too long. The agent can find the reason in the code faster than I can.

But my requirements aren’t just that dividing 7 into 25 gives me 3 and 4.

It’s that when the divisor is zero, I get an answer that says division is undefined. (25 / 0 is not Infinity ⁠— I’m looking at you, JavaScript.)

It’s that the quotient and remainder are always integers when division succeeds. It’s that it handles negatives on top or bottom or both according to the rule that I specified.

And I decide what happens if someone gives it something other than an integer.

And, of course, this includes performance checks, security checks, etc.

Those checks run outside the implementer’s control. An auditor can dig through the code if that’s where the problem is. What I need back is a failure I can understand and do something about.

My job is to anticipate the problems and write the specification so carefully that it might as well be airtight.

And to help with this, I have architected software that helps me find cases I haven’t accounted for. It suggests new rules, essentially.

And I use this to both create the specification ⁠— the single source of truth with which the AIs work, and the gates that check that work ⁠— gates outside the control of the AIs.

Suppose the software says 25 divided by 7 is 3 with 5 left over. A gate that checks only the quotient will let that answer through.

I approve or disapprove the gates. If my gate lets the wrong answer through, that’s on me.

Initialisms and abbreviations
AI
artificial intelligence
API
application programming interface