Programming with AI
ENRU
2.1

Why read code if the AI writes it

reading and being able to write are different skills

What it is

The central misunderstanding of this chapter sounds like this: "if the AI writes the code, reading it is optional." It isn't — and here is why.

Reading and writing are different skills, and reading is far easier. To write a function from scratch you have to hold the syntax, the library and the order of operations in your head. To read a finished one, it is enough to understand what each line does. The second is learned several times faster and gives you almost all of the benefit.

Why it matters in practice

Without reading, three things from the working cycle stop working.

Checking. You cannot be sure the code does what is needed if you don't understand what it does. A run only checks the case you ran.

Arguing. When the AI proposes something you don't like, you need substantive grounds. "I feel like something's off here" it will bat away; "this function overwrites the input list, and that list is used later" it will not.

Ownership. A month from now somebody — most likely you — will open this file. If nobody read the code while it was being written, you will be working it out from scratch, and at the worst possible moment: when something has broken.

How much reading is enough

You do not need to understand every character. You need to be able to answer four questions:

QuestionWhy
What does this function take and return?to know how to use it
Does it change anything outside itself?to predict the consequences
What happens if the data is not what was expected?to find holes before users do
Where is it called from?to know what breaks when you change it

If all four have answers, the code has been read well enough. Working out exactly how the algorithm inside is implemented is usually unnecessary.

What to tell the AI

Reading does not have to be done alone. An AI explains its own code well, if you ask properly (article 3.7):

Prompt
Explain line by line what this function does. Separately:
what it takes, what it returns, and what it changes outside
itself.

The reverse is useful too — read it yourself and check with the AI:

Prompt
Here is how I read it: the function takes a list of orders,
sums them up and writes the result to the log. If the sum is
zero it writes nothing. Did I miss anything?

The second way teaches faster: you think first, then compare. Mistakes in your understanding surface immediately, and they stick.

What to look for

"Looks right" is not reading. Code written by an AI almost always looks right: even indentation, clear names, tidy structure. Outward neatness says nothing about what it does.

Long code does not have to be read in full. Start with the function signatures and the entry point. If those make the connections clear, you can leave the insides alone until you need them.

An unfamiliar construct is not a reason to give up. It is perfectly normal not to recognise something: a decorator, a generator, async with. Ask what it is — this chapter has an article for each of them.

Cheat sheet

  • Reading and writing are different skills. Reading is learned faster.

  • Without reading, checking, arguing and ownership all stop working.

  • Enough is: what it takes · what it returns · what it changes outside · where it is called.

  • "Looks right" is not the same as "has been read".

  • Read it yourself, check with the AI — that is the faster way to learn.