jonnifyagile agents
jonnify / Agile Agent Workflow / A4 · Spec / A4.1 / A4.1.3 · Removing ambiguity

A4.1 · Specification by Example · dive 3

Removing ambiguity

An abstract requirement is a set of possible readings. The work of specifying by example is choosing the cases that narrow that set to one — before a line of code is written.

“Handle a request with no signed-in learner” could mean a 404, a crash, showing another learner's courses, or a redirect. Each worked example rules out the readings it contradicts. Slide on the right to add examples and watch the surviving readings fall — the protected /my/courses closes on one: a redirect.

Add examples · watch the readings fall to one

3
"handle a request with no signed-in learner" — candidate readings return a 404 raise / crash on the request render whatever courses the request named redirect — never another learner's courses
3 examples added — 1 reading survives: redirect, never another learner's courses. The other three readings are removed by the examples that contradict them. The ambiguity is gone before any code is written.

A requirement is a set of readings

Ambiguity is not vagueness. “Handle a request with no signed-in learner” is a perfectly clear English sentence; what it lacks is a decision. It admits a 404, a crash, showing another learner's courses, a redirect — each a legitimate reading of the same words. The requirement names a set of possible behaviours and stops, leaving the choice to whoever builds it.

Removing ambiguity is the act of adding worked examples until exactly one reading survives. Each example is a concrete case with a stated result, so it contradicts every reading that would have produced a different result — and rules them out. Add the case “a request with no signed-in learner is redirected” and the 404, the crash, and showing another's courses are all gone. The set has been narrowed to one, and it was narrowed before a line of code was written.

ambiguity
A requirement that admits more than one reading. The words are clear; the decision is missing.
a reading
One behaviour the requirement could mean. "Handle a request with no signed-in learner" has at least four — a 404, a crash, showing another's courses, a redirect.
removing ambiguity
Adding worked examples until exactly one reading survives. Each example rules out the readings it contradicts.
before code
The narrowing happens in the spec, ahead of the build, so the agent has one reading to implement and no choice to invent.

An example removes the readings it contradicts; enough examples leave one. The skill is choosing cases that, together, cover the behaviour and converge — not piling on cases that all say the same thing.

Ambiguous, or a pinning example

The test of a statement in a spec is simple: does it leave many readings open, or does it pin one? An abstract phrase — “handle bad input,” “show something reasonable” — opens readings; a worked example — “a request with no signed-in learner is redirected” — closes them to one. The same spec usually carries both: the prose frames the intent, the examples pin the behaviour.

Select a statement below. The figure reports whether it is an ambiguous requirement (many readings) or a pinning example (one reading), and why. A spec that is all prose can be argued with; a spec whose examples pin every behaviour cannot.

Classify a statement · pick one

"handle bad input" admits a 404, a crash, a redirect, an empty page — many readings AMBIGUOUS REQUIREMENT · readings open: many
"handle bad input" — AMBIGUOUS REQUIREMENT. It admits a 404, a crash, a redirect, and an empty page: many readings, none chosen. A pinning example is needed to close it to one.

A prose requirement opens readings; a worked example closes them — the spec needs both, but only the examples pin the behaviour.

On the Portal

On the Portal — the learning platform this course builds — the spec for the learner-enrollments page opens with the abstract intent: serve a learner their own courses and handle a bad request gracefully. Left there, “gracefully” is a set of readings. The spec closes them with worked examples: Portal.Enrollment over an enrolled learner, a learner with no enrollments, and an unauthenticated request, each with a stated result. The not-signed-in case pins the one reading that survives — a redirect, never another learner's courses.

The fragment below is spec text: the abstract Definition-of-Done phrasing set against the pinning Given/When/Then settled at . The contrast is the whole lesson — one line read many ways, three examples that leave one.

# the abstract intent (one line, many readings until pinned):
#   "the page must handle a bad request gracefully"
#   readings: a 404? a crash? another's courses? a redirect?  ← undecided

# stories (F6.5) — the worked example that pins ONE reading:
#   Given a request with no signed-in learner,
#     when GET /my/courses,
#     then it redirects — never another learner's courses.

surviving_reading = "redirect, never another's courses"  # the one the examples leave
removed           = :the_other_three             # 404, crash, another's courses — ruled out

The principle

Choose worked examples until exactly one reading of the requirement survives. The examples remove the ambiguity in the spec, before the agent builds.

On the Portal

The Portal pins “handle a bad request to /my/courses” to three Portal.Enrollment cases; the redirect reading is the one that survives, and it is the acceptance check.

The examples narrow a requirement's readings to one in the spec — so the agent implements a decision, not a guess.

Recap — many readings to one

A requirement is a set of readings; ambiguity is the missing decision, not vagueness. Removing it is adding worked examples until exactly one reading survives, each example ruling out the readings it contradicts — and the narrowing happens in the spec, before a line of code is written. The Portal closes “handle a bad request to /my/courses” to the redirect reading. That closes the module: examples are the specification, they are living documentation that cannot drift, and they remove ambiguity. The next module names which artifact carries which part of all this.

Next, module A4.2 · The triad: spec, stories, agent brief — which artifact answers which question, so no document is crammed. Return to the A4.1 module hub to continue.

References

The sources behind removing ambiguity, and where it connects in the course.

Sources

Related in this course