Explain like I'm five · AI

What is Code Generation?

Code generation and coding agents, told as a story about a parrot that read a mountain of code and fixes it by running it with its own toolbox.

I read a mountain of code too!CODEdef add(a, b): return a - b(it subtracts instead of adding)why does this function not work?code is text too — the pile the parrot read is full of code

The carpenter asks: why does this function fail? The parrot read a mountain of code too.Code is text too. The pile the parrot read holds encyclopedias, novels, and a lot of code.

mountains of codeforiin?NEXT BEANrange ★★★★★banana ☆tight rules — the bean fits welljust import magiclib!CODEimport magiclibmagiclib.fix()(no such library exists)it continues plausible code toogood because it fits — risky because it is plausible

Code has tight rules, so the beans fit well. But it continues plausible code too.With mountains of examples, the next bean fits well. But the plausible parrot shows up in code too — calling libraries and functions that do not exist.

NOTEmake the tests passfile: add.pytoolbox: open · run · searchdef add(a, b): return a + b> run tests× 1 failed (a - b)> fix, run again✓ 3 passedit runs the code and fixes what failsa coding parrot reads and writes code, runs it with its tools, and fixes it

A coding parrot reads and writes code, runs it with its tools, and fixes it.The toolbox holds open-file, run, and search. A parrot that runs and fixes on its own is called a coding agent.

Ask for small piecesone function at a time
Give the tests firstnow it has a target
Hand back the resultit fixes itself
A person reads and mergesthe last step is human
NOTEadddef add(a,b): return a-brun× errordef add(a,b): return a+brun✓ passhand back the error, try againnotecodered errorfixgreen passhand back the error and the parrot fixes it itself — a few lapsgive the tests first and the laps get fewerpass means it matches what the tests asked — nothing more

Note, code, red error, fix, green pass. Hand back the error and it runs a few laps.Give the tests first and the laps get fewer. Pass means it matches what the tests asked — nothing more.

CODE✓ 3 passeda person reads itread, understand, then mergeCODE✓ 3 passedpassword = 1234a holepassing is not the same as safecode pasted without understanding — later nobody can fix itafter the green ✓, a person's eyes — safety and understanding are theirs

Passing is not the same as safe. And code pasted without understanding — later nobody can fix it.Security holes are found separately with code scanning. After the green ✓ come human eyes. The parrot that plans its own steps is the agent story.

In one breath

Code generation = a parrot that read a mountain of code picking the next code bean well. A coding agent is the parrot that runs and fixes with its toolbox. After the ✓, a person reads.

Code has strict grammar and vast public examples, so next-token prediction fits it especially well. A coding agent uses tool calls (read, write, run, search) to run tests and iterate on the errors. Typical risks are calls to APIs that do not exist (hallucination), security vulnerabilities, and unmaintainable code, so code review and secure-coding scans are needed.

When grown-ups say it

Code generation
The parrot that writes code. Tight rules and mountains of examples make the next bean fit well.
Coding agent
The parrot with a toolbox. Opens files, runs them, fixes them. → the parrot that plans its own errands
Code completion
Saying the next line first. While you type, it shows the next few beans ahead of time.
Test-driven
The target first. Give the tests first and the parrot fixes the code to pass them.
Execution feedback
Handing back the red error. Show it the error message and it fixes itself. A few laps.
Code review
A person reads and merges. The step after the ✓. → the last step is human
Secure coding
Finding the security hole. Passing does not mean safe. → code scanning
Tool calling
The toolbox. The parrot writes a note asking for a tool and the trainer runs it. → the toolbox
Next story
The Errand Order Chart →
Want another term as a picture book? Request →