Skip to the content
Peabody TeachFor teachers and grown-ups

📝 Say It So Exactly That a Machine Gets It v0.1.0

Students write a precise description of a small program: what goes in, what comes out, the rules, the odd cases and what done means. A spec is what "writing code" is when an AI does the typing, and it is if-then and loops said in plain words.

  • For: 6th to 8th
  • Time: about 45 minutes
  • The question: How do you describe a program so well that nobody has to guess?

You will need

  • The printable's spec sheet
  • Pencils
  • A screen at the front for the last step, or nothing if you use the paper version

The lesson, step by step

  1. A weak ask

    Write on the board: "Make a program that tells me if a number is big." Ask: "What would a machine need to know before it could do this?" Collect the questions: big compared to what? Is 10 big? What if it is a negative? What should it say? Each question is a hole in the spec.

  2. The five parts

    Show the five parts of a spec: what goes in, what comes out, the rules (as if-then sentences), the odd cases (zero, nothing, too big, a tie) and what done means. Fill them in together for the weak ask until no question is left.

  3. Write your own

    Each student picks one: a program that counts how many weeks and extra days are in a number of days, a program that says whether a word is longer than five letters, or a program that gives a discount once a score is high enough. They fill in the five parts on the sheet, using rules in if-then form.

  4. Test the spec on a friend

    Pairs swap specs. The reader answers three questions that the spec does not answer. Every unanswered question is a hole, and the writer closes it. Do two rounds.

  5. Write the tests first

    Under the spec, each student writes four tests as an input and the output they expect: two ordinary cases and two odd ones. These come from the spec, not from the program, so they are the judge later.

  6. Now ask the AI

    Use the box below. A good spec makes a good result, and a bad one shows exactly where it was bad.

Questions to ask while they work

  • What would a machine have to guess here?
  • What goes in, and what comes out?
  • What happens at exactly the edge, for example 7 days or a score of 10?
  • How will you know it is done?

Now ask the AI

Choose one student's spec (with their say-so) and type it exactly as written. The teacher types, at the front, on a screen everyone can see. Use an AI tool your school allows. No name, school or personal detail goes into the box, ever.

What to send:

Write a short program, in plain numbered steps, for this spec. Do not change the spec. If something is missing, tell me what you had to guess. [paste the spec]

What to check in what comes back:

  • Did it follow every rule, or only most?
  • What did it guess? Was that a hole in the spec?
  • Run the four tests by hand against its steps: which pass?
  • Did it handle the odd cases, or skip them?

Write it down: Write down what it got wrong, and for each mistake say whether the hole was in the spec or in what the AI did.

No AI today? Do it on paper: Be the machine

The same step, with people and paper, for when an AI is resting, not allowed at your school, or not what you want in the room.

  1. Swap specs with a partner. The partner is the machine and may use only the words on the spec; they may not ask the writer anything.
  2. The machine writes numbered steps on paper and marks every place it had to guess.
  3. The writer runs their four tests by hand against the machine's steps, and marks pass or fail.
  4. Together, mark each failure as a hole in the spec or a slip by the machine. Fix the spec.

If it goes fast

  • Write the spec for the lunch line, a bell schedule or a board game's turn.
  • Write the shortest spec that still has no holes, then the longest one, and compare.
  • Take a spec you wrote earlier in the year and find its holes now.

The printable

One for each student. The five boxes are the spec; the test boxes come from the spec, not from the program.

◂ Read It, Run It, Say It · All ten lessons · Test Plans, and Where AI Gets It Wrong ▸

Nothing on this page is sent to us. The printable has a blank name line and no child's details. No sign-in, no ads.