Chapter 4: Reading and debugging

Explain it out loud

Also called Rubber duck debugging

Explaining the problem line by line to anything at all: a colleague, a pet, a rubber duck. You often spot the mistake part way through, because explaining makes you say what you had only been assuming.

Writing a careful bug report for an agent does the same job, and you will often find the answer before you send it. It works the other way too: making an agent explain code back to you shows what it assumed, though its account of its own reasons can be a made-up story.

Say it to your agent

“Don't fix anything yet. Explain this function to me line by line, saying what you expect each variable to hold at that point. Mark any line you are not sure about with UNSURE.”

The workshop

Name a word, or describe what you mean in everyday language.