Unit 2 activity: Ada's ordered procedure

DEVELOPMENT REVIEW DEPLOYMENT - NOT READY FOR RELEASE

Required work: about 12 minutes. Pen and paper is fine; so is a text file. An optional extension at the end adds more if you want it.

Ada Lovelace had to write a procedure for a machine that could not be relied on to fill in anything she left out. You are going to do the same thing with a task you already know how to do, and find out how much of it you have never actually said out loud.

Part 1 — choose a task (1 minute)

Pick something ordinary that you can do without thinking, and that takes six to ten steps: posting a parcel, changing an inner tube, putting a duvet into its cover, returning an overdue library book, making a cheese sandwich for someone else.

Do not pick something you already think of as a procedure — a recipe you follow from a card, or anything with an instruction manual. The exercise only works on something you do from memory.

Part 2 — write the procedure (5 minutes)

Number your steps from 1, and hold to these six constraints. They are what turn a description into a procedure.

  1. One action per step. If a step contains "and", consider splitting it.
  2. Name every object before you use it. If step 6 refers to the tray, some earlier step must have introduced the tray. This is explicit state.
  3. Give every quantity a number. How much, how many, how far, how hot. "Enough" and "a little" are not quantities.
  4. Give every wait a duration or a condition. Either "wait 4 minutes" or "wait until X happens", where X is something observable.
  5. No pronouns. No "it", "them", "the other one". Write the noun again. This feels absurd and it is where most of the gaps get exposed.
  6. State the starting state and the finishing condition. What is true before step 1, and what is true when you are done?

To see the difference the constraints make — bad: "Add some water." Good: "Pour 250 ml of cold water from the tap into the mug introduced in step 1."

Write the whole thing before you edit any of it. You want the first draft to be honest about what you would actually have written.

Part 3 — the literal reader pass (4 minutes)

Read your own procedure the way a machine would: refuse to supply anything that is not written down. Take each step in turn and ask "could I do only what this says, knowing nothing else?"

Mark every gap you find with a letter:

Code Gap
A Unnamed object — a noun used that no earlier step introduced.
B Missing quantity — how much or how many is not stated.
C Missing duration or timing — a wait with no length and no condition.
D Missing precondition — the step only works if something was already true, and nothing says it is.
E Missing repetition or stopping rule — something has to happen more than once and the procedure does not say how many times or when to stop.
F Ambiguous reference — "it", "them", "the other one".
G Hidden decision — the step needs judgement, and the criterion for that judgement is not written down.

Count them. Most people find between five and fifteen in a first draft of a task they have done hundreds of times. That is the normal result and it is the point of the exercise, not a sign that you wrote it badly.

Part 4 — fix one of them properly (2 minutes)

You do not have time to repair the whole procedure, and you do not need to.

Choose the single gap that would cause the worst outcome if a literal reader hit it, rewrite that step so the gap is closed, and write one sentence saying why you chose that gap rather than another.

That sentence is doing real work. Deciding which unstated assumption matters most is the same judgement you will need in Unit 3, when you decide which parts of a generated output have to be checked and which do not.

Now take the checkpoint

This unit's checkpoint is cp02-ordered-steps. It gives you somebody else's procedure and asks what is missing from it — the same literal-reader pass you have just done on your own work, which is considerably easier on a stranger's writing than on your own. Parts 1 to 4 are all you need for it.

python3 selfcheck.py run cp02-ordered-steps  # or in the browser

Run the Python route from course/lab/. If you get it wrong, read the feedback before retrying: it distinguishes between things genuinely missing from a procedure and background knowledge that a procedure is not obliged to supply, and that distinction is the one this unit exists to teach.

Keep your annotated procedure. Unit 10 is about writing specifications precise enough to be tested, and it will ask you to look at this again.

Optional extensions

Optional. These sit outside the core study time, are not required for the checkpoint, and nothing later in the module depends on them.

Repair the rest of the procedure (about 5 minutes). Part 4 asked for one repair. Close the remaining gaps as well, then reread the result: it will be longer, flatter and duller than your first draft, and it will be the version a literal reader could follow. That trade is the one Note G makes on every page.

Swap with someone else (about 5 minutes). Run the literal-reader pass on another learner's procedure and have them run it on yours. Gaps in a stranger's writing are obvious; gaps in your own are invisible by construction, which is the whole difficulty this unit is about.

If you write code (about 15 minutes). Rewrite your procedure as a variable table in the style of Note G. Give each object a name — V1, V2, and so on — and for each step record: the operation, the variables read, the variable written, and the state of every variable afterwards. Then answer two questions. Which steps turned out to read a variable that had never been written? And where did you need a loop, and what is its termination condition?

Marking guidance — open this once you have done the activity, to check your own work

The activity has no single correct output — everyone picks a different task. What you can check is whether you found the gaps, and whether you classified them for the right reason.

A worked example

Here is a first draft of the kind most people produce, for posting a parcel. The gap codes are those from the activity.

  1. Put the item in a box.
  2. Seal the box.
  3. Write the address on it.
  4. Take it to the post office.
  5. Queue.
  6. Tell them what service you want.
  7. Pay.
  8. Keep the receipt.

Annotated:

Step Code What a literal reader cannot do
1 A, B No box has been introduced, and no size is given. Which item, and which box?
2 A Sealing requires tape or a seal. Nothing has introduced any.
3 F, A "It" — the box or the item? And no address has been supplied to the procedure at all.
3 D Writing on a sealed box assumes a writable surface and a pen; neither is stated.
4 A, D Which post office? The procedure never establishes that one is open, or reachable.
5 E Queue until when? The stopping condition is the whole content of the step.
6 A, G "Them" is undefined, and which service is a decision with no stated criterion.
7 B How much? The amount is produced by step 6 and never captured anywhere.
8 D The receipt was never introduced; step 7 has to produce it for step 8 to keep it.

Two features of that annotation are worth dwelling on.

The gaps cluster around values that are produced and then needed later. The address, the price, the receipt: each is a value that some step must generate and store before a later step can use it. That is precisely the explicit-state property from the reading. In Note G, every such value has a named column and a line that puts it there.

Step 5 is the interesting one. "Queue" is not a single action; it is a repetition with a termination condition, and the condition is the only part that matters. If you spotted repetition and stopping rules, you have understood control flow, which is the hardest of the three properties to see in everyday language.

Marking your own work

Count the gaps you found, then check your classification against these two questions.

Did I mark anything that is not really a gap? A procedure has to state every action, object and quantity it depends on. It does not have to explain what the result is for, why anyone would want it, or supply general background knowledge about the world. "It doesn't say what a parcel is" is not a gap in the procedure. The distinction matters and the checkpoint tests it.

Did I miss a whole category? Look at the seven codes and see which ones you never used. Most people find A, B and F easily, because they are visible on the page. The three that get missed are:

If you used none of D, E or G, go back through your procedure once more looking only for those. There is almost certainly at least one.

A good answer to Part 4 chooses its gap by consequence, not by how obvious it is: which gap would produce the worst outcome if a literal reader hit it? If you repaired the easiest gap you have done the exercise; if you repaired the most dangerous one you have done the thinking Unit 3 needs.

Repairing the remaining gaps, swapping procedures with someone else, and the Note G variable table are all optional extensions. They are not part of the required work, they are not needed for the checkpoint, and the guidance below assumes they have not been done.

Checking your own work

The required work takes about 12 minutes; the three optional extensions add roughly 5, 5 and 15 minutes and are outside the core budget. None of it is graded.

What a strong response looks like:

If your result does not look like that, find yourself in the first column:

What happened Why it usually happens What to do
You found very few gaps You are reading co-operatively, supplying the missing meaning as you go. Swap procedures with someone else. Gaps in a stranger's writing are obvious; gaps in your own are invisible by construction.
Your gaps are all types A, B, F Surface reading. Ask yourself directly: which step happens more than once, and how does it stop?
You wrote the procedure as prose The task you chose was too abstract to break into steps. Start again with a physical task, with objects you could point at.
You marked background knowledge as a gap The rule applied too widely. "The procedure never introduces the tape" is a defect; "the procedure never explains what tape is" is not.

The point, whatever you produced. Unstated assumptions are invisible to the person holding them. That is not carelessness; it is what an assumption is. The remedy is not to try harder, it is to have a procedure for finding them — which is why the activity gives you seven codes instead of telling you to check your work carefully.

This also sets up the module's central problem. In Unit 7 you will read a generated routine that looks complete, and the assumptions it makes will be just as invisible as the ones in your own procedure — with the added difficulty that they are somebody else's assumptions, made by a process that has no obligation to be consistent about them.

On the historical material

If you are wondering which parts of the "first program" story you are supposed to believe, the honest answer is the one on the reading page: publication date and the existence of the ordered table are established; priority relative to Babbage's unpublished notebooks and the division of labour on Note G are contested and cited to the relevant historical sources in the reading. course/historical-notes.md and Unit 16 are where that is worked through; this activity deliberately does not settle it.

Do not let the contested points be settled by an AI system's confident summary. If you catch yourself doing it, that is a live and slightly awkward demonstration of the module's own thesis.

The checkpoint

This unit's checkpoint is cp02-ordered-steps. Its question, options, correct answer and diagnostics are defined once, in the checkpoint block at the end of this file; ../lab/checkpoints.py and the browser self-check both read that block, so the two routes ask the same question and give the same feedback.

It tests the same literal-reader pass as the activity, and in particular the distinction between a genuine omission and background knowledge a procedure is not required to supply. If you get it wrong, ask yourself which nouns in the given procedure were never introduced before use — that is the question the feedback pushes you towards.

python3 selfcheck.py run cp02-ordered-steps  # or in the browser

Your private activity record

Browser storage is not a permanent copy

Progress is kept only in this browser, profile and device. Private browsing, clearing site data, removing the profile, a browser reset, storage eviction or device loss can erase it. Keep important answers and contributions separately.

These notes stay in this browser unless you download a backup or activity log.